Avec Ansible vous pouvez automatiser des actions sur des machines à distance mais il peut y avoir des soucis avec certaines distributions Linux

Voici quelques liens vers des astuces.


hat was when I realized a simple thing: ansible was able to connect.

The problem was that the ubuntu user on the remote machine, when I ran commands with sudo, was asking for the password!

Then, the fix was simple on the remote machine (ubuntu in this case): I ran some commands to allow the users on the sudo group (which was the case of the ubuntu user) to do sudo passwordless - that was safe in my case because the machine only allowed login as the ubuntu user, with ssh keys, and had fail2ban installed to stop attempts from others to login.

Here are the commands I ran on the remote Ubuntu machine:

# become root:
$ sudo su

# to edit the sudo configuration (this will open vi)
$ visudo

Inside this file, I changed the following configuration:

# Allow members of group sudo to execute any command
# %sudo         ALL=(ALL:ALL) ALL

After that, I logged off from the machine, logged in again, and ran sudo su again.

I was then able to run this sudo command without a password.