Hello,
Yes, its possible to use ansible without root password.
There are two ways you can do this.
1. Create an user and add that user to sudo group. Let's say username is 
anisble. These commands should be run as root in the ubuntu2 machine.
*useradd ansible*
*usermod -aG sudo ansible*
*visudo*

Once the visudo opens, replace this line 
*%sudo   ALL=(ALL:ALL) ALL*  with the line *%sudo   ALL=(ALL:ALL) 
NOPASSWD:ALL*
so that the user ansible will not be prompted for password when becoming a 
sudo user.

2. The same can be done with the ubuntu user as well. 
Let me know if there is any ambiguity.
-Ravi Kumar

 

On Friday, May 7, 2021 at 3:10:01 PM UTC+5:30 [email protected] wrote:

> Hi all, I'm a newbee on ansible and I follow online tutos.
>
> I installed 2 ubuntu VM (named ubunt1 and ubunt2), one as node manager 
> (ubuntu1) and the second one as simple node (ubuntu2). The ssh connection 
> is tested and ok.
>
> When I installed ubuntu, I've never been asked for a root password, but 
> only for the name/password for a simple user. But this user belongs to 
> sudoers group so it can make admin tasks. So all is ok.
>
> The pb is that as I try to execute root tasks from ubuntu1 to ubuntu2 with 
> ansible, even if ubuntu2 user belongs to sudoers groups, ansible fails. And 
> if I use the "-become" option, ansible asks me the ubuntu2 root password 
> that I don't know of course.
>
> In fact I feel that the fact that ubuntu2 user has sudo privilege is 
> useless.
>
> So how to do ?
>
> Thanks for your responses.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/68b707a3-d70a-4ac7-acf8-ddc6c72c944an%40googlegroups.com.

Reply via email to