Beginner, can't complete this step

110 views
Skip to first unread message

boncalo mihai

unread,
Jan 14, 2019, 5:44:46 PM1/14/19
to ansible...@googlegroups.com
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.

James Cassell

unread,
Jan 14, 2019, 5:51:05 PM1/14/19
to Ansible List
Try priviledge_escalation -> privilege_escalation

V/r,
James Cassell

boncalo mihai

unread,
Jan 14, 2019, 5:54:35 PM1/14/19
to ansible...@googlegroups.com
Work like a charm! Thank you!
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1547506254.3074073.1634602840.220124BD%40webmail.messagingengine.com.
> For more options, visit https://groups.google.com/d/optout.

Will Brown

unread,
Jun 27, 2020, 7:10:30 PM6/27/20
to Ansible Project
Yes! Worked like a charm for me also! 
I hoped I was close in my configurations following along with using Hands-on Ansible with Sander van Vugt 
when I got stuck. Unstuck now! 
Thank you!

Reply all
Reply to author
Forward
0 new messages