Ansible managed host issue

Hi guys,

Could you please help me regarding to the following issue?

I have setup a control host and 2 managed host, IP Addresses are static and dns is over /etc/hosts file. SSH Keygen is created and copied to managed hosts and I can ssh to managed host without password.

Ansible installed:

[ansible@control install]$ ansible --version
ansible 2.9.6
config file = /home/ansible/install/ansible.cfg
configured module search path = [‘/home/ansible/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /home/ansible/.local/lib/python3.6/site-packages/ansible
executable location = /home/ansible/.local/bin/ansible
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

Note: ansible1 and ansible2 are managed hosts.

When I add command - ansible all -m user -a “name=lisa”- it gives the following message:

ansible2 | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“msg”: “useradd: Permission denied.\nuseradd: cannot lock /etc/passwd; try again later.\n”,
“name”: “lisa”,
“rc”: 1
}
ansible1 | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“msg”: “useradd: Permission denied.\nuseradd: cannot lock /etc/passwd; try again later.\n”,
“name”: “lisa”,
“rc”: 1

It took me a lot of time to find solution, but could not find anything. Is anyone faced with this error message

Hi guys,

Could you please help me regarding to the following issue?

I have setup a control host and 2 managed host, IP Addresses are static and dns is over /etc/hosts file. SSH Keygen is
created and copied to managed hosts and I can ssh to managed host without password.

You need to be superuser (root) on the managed hosts to create new users.

Add -b (--become) and if applicable -K (--ask-become-pass) to your command line.

Regards
        Racke

It worked, gr8 thanks. I am new in ansible and learning with Sanders’s RHCE video course.