Deploy a file on a converged server with ansible

Hi everyone !

I got an issue when I want to deploy a file with ‘ansible-playbook’ on a converged server. The problem is that I can’t put myself in (root) on this server.

I tried to add ‘become:yes’ on my tasks but the issue is the same…

The issue I got is : FAILED! => {“msg”: “Missing sudo password”}

If anyone can help me it could be great !

Still here if you have questions about my issue

I would guess that the user your are connecting to the server as doesn’t have password-less sudo?

You can test this manually, SSH to the server as the user and run sudo -i and see what the result is.

The way I approach this is to add the user to the sudo group and then add this to /etc/sudoers:

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

Best use visudo to edit /etc/sudoers as this will check it is valid before saving the config.

1 Like

Thank you for your response !

The problem is that I can’t execute this type of command (I can’t execute visudo and modify etc/sudoers)…

My user only have the rights to create files/folders.

Ansible can only do what your user account can do, if you don’t have sudo rights then Ansible won’t have these rights either, you could set become: false to avoid the error if all you need to do is manipulate things using your user account.

2 Likes