I am getting to learn Ansible and I liked it the first second I saw how simple this is. What I eventually want to achieve is to manage Windows clients and install software in a consistent way. Unattended. Chocolatey here I come. But first things first. Let’s start with a linux host.
So I assume that ansible is installed.
- Add the host name in /etc/hosts or if you have DNS online don’t bother. This needs to be done on the ansible host
- Add the host in the /etc/ansible/hosts file. Make sure you add it to a group. Groups can we made like this: [groupname]
- On the Client create a user. For example ansible:ansible. Then
visudo
and under theroot
directive addansible ALL=(ALL) NOPASSWD:ALL
- Now on the ansible host
su ansible -
No you need to copy the SSH key to the client server.ssh-copy-id [email protected]
You should be able to ssh into the client without passwords and becoming root should be seamless.
Try to execute a ansible command like ansible ubuntu -m setup
On a side note. You might need to install python in ubuntu. As this is not by default installed on 18.04