Skip to content

Managing users and groups

Mohit edited this page Aug 9, 2017 · 1 revision

Creating a system group

ansible multi -s -m group -a "name=admin state=present system=yes" -i ./hosts

Creating a user -- adding to a group, create home directory, adding ssh keys

ansible multi -s -m user -a "name=mohitsharma44 group=admin createhome=yes generate_ssh_key=yes" -i ./hosts

Deleting a user along with the home-directory

ansible multi -s -m user -a "name=mohitsharma44 state=absent remove=yes" -i ./hosts