README.md

Add user with ansible

Adding a new user to your system with ansible

Description

Ansible is an open-source software provisioning, configuration management, and application-deployment tool. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. It uses YAML syntax. The task is to add a new user to the system. The ansible user module can be used to accomplish this. The docs can be looked upon here - https://docs.ansible.com/ansible/latest/modules/user_module.html

Running the playbook

The following command can be used to run the playbook -

➜  ~ ansible-playbook adduser.yaml -K

Adding a user requires root privileges so this prompts for the password. (note that the current user needs to have access to sudo)

Switching to new user

Now to switch to the newly created user (in this case raj) we can use the following command -

➜  ~ sudo su - raj

This should now switch us to the newly created user.
new_shell