Ansible 101 : Configuring the managed machines to communicate with the Ansible controller




We start by checking if the ssh server is installed on the managed machine:


Then we check its status, to see if the ssh process is running and ready for connections:


If it is nor running, we could start it using the below command:


We also check if python is installed on the managed machine:


On the managed machine, we open the ssh port using the below command:



On the ansible control machine, we log in as user ansible_user.

The user ansible_user needs to connect to the managed hosts through ssh without providing a password, he also needs to run tasks as  root user.

For that we use the ssh public and private keys.
The public and private keys are generated on the control machine.
Then, we could need to copy the public key in the managed host.

While authenticating,  an authentication token is generated using the ansible_user private key, and is sent to the managed machine to compare it to the public key stored there.

To generate the public/private pair, we use the below:


We can press <enter> if we don't want to use a passphrase.

We use the below command to copy the public key to the managed host:

Comments

Leave as a comment:

Archive