Hi
Sorry , this must be to easy for you but I can't figure it out. I was
following some ansible video tutorials and I can't go further because
of some errors
ansible all -m user -a name=linda
ansible3 | FAILED! => {
"changed": false,
"msg": "useradd: Permission denied.\nuseradd: cannot lock
/etc/passwd; try again later.\n",
"name": "linda",
"rc": 1
}
ansible4 | FAILED! => {
"changed": false,
"msg": "useradd: Permission denied.\nuseradd: cannot lock
/etc/passwd; try again later.\n",
"name": "linda",
"rc": 1
}
ansible2 | FAILED! => {
"changed": false,
"cmd": "/sbin/useradd -m linda",
"msg": "[Errno 13] Permission denied",
"rc": 13
}
ansible1 | FAILED! => {
"changed": false,
"cmd": "/sbin/useradd -m linda",
"msg": "[Errno 13] Permission denied",
"rc": 13
I'm trying to add an user on 4 machines.
-created project directory
-created ansible.cfg file with this content:
[defaults]
remote_user = ansible
host_key_checking = false
inventory = inventory
[priviledge_escalation]
become = True
become_method = sudo
become_user = root
become_ask_pass = False
-created inventory file:
[all]
ansible1
ansible2
ansible3
ansible4
-user ansible was created on all machines and has sudo access
-ssh-copy-id was used for all machines
-all machines are in /etc hosts with the name from inventory file
From what I see, ansible is trying to add the user without becoming root
Adding user or becoming root works without any issue
Thank you,
Mihai.