How can I create a new user using ansible ploybook?

0 votes

So, I wanted to create a new user with password on a host machine using ansible.

This is the play I wrote:

var :
  - name: creating user
    user: name=john password={{password}}

after I executed the above playbook, I tried to login with that user on another server using:

[root]# su - test

But it didn't ask for password to login

[test@localhost ~]$ 

Why isn't it asking for password?

Mar 29, 2018 in Ansible by Atul
• 5,510 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You're switching from the root user. Root doesn't require passwords to switch users. If you want it to ask for a password, try to SSH into the host machine from your control machine using:

ssh test@localhost

answered Mar 29, 2018 by DareDev
• 6,710 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Using multiple config files using same template in a role in ansible

Go through this include_role module: tasks: - ...READ MORE

answered Jun 5, 2018 in Ansible by DareDev
• 6,710 points
0 votes
1 answer

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,710 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.