Op 'server' als root
> ssh-keygen (indien nog niet gedaan)
> ssh-copy-id remote (wel zorgen dat root remote ssh kan)
Op Clients:
> apt install open-ssh
> vi /etc/ssh/sshd_config (PermitRootLogin yes)
> apt -y install ansible
> Bij ubuntu 19: ln -s /usr/bin/python3 /usr/bin/python
**Server**
Wijzig host file: /etc/ansible/hosts
> [Workstations]
> desktop1
> desktop2
> [Servers]
> server1
> server2
Test connecties
> ansible -m ping all
Draai remote commando's
> ansible -m shell -a 'hostname' all
> ansible -m shell -a 'df -h' workstations
Maak enkele eenvoudige taken ahv playbook:
> Eenmalig:
>> mkdir roles/ (eenmalig)
> mkdir roles/basic (eenmalig)
> mkdir roles/basic/tasks (eenmalig)
>
> vi roles/basic/tasks/main.yml
>> name: "Installing VIM"
> apt: pkg=vim
>>
>> name: "Installing net-tools"
> apt: pkg=net-tools
>>
>> name: "Installing cockpit"
> apt: pkg=cockpit
>
> vi playbook.yaml
>> ---
>> - hosts: workstations
>> become: true
>> roles:
>> -- basic
>
>Run
>> ansible-playbook playbook.yaml