From the course: Red Hat Certified Engineer (EX294) Cert Prep: 1 Foundations of Ansible

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Manage users

Manage users

- [Instructor] Managing users is definitely better using playbooks than it is using ad hoc commands. Mainly, due to users being in state of the configuration. It's better to look at a user existing as part of the configuration than a command that you would run. We can manage users with ad hoc commands. For instance, to create a user named user2, type in ansible, space rhhost2*, space -m, space user for the user module, space -a and for arguments space 'name=user2, space, state=present space home=/home/user2, space shell=/bin/bash, 'space -b space -K and hit Enter. Then enter your password. Here we're defining the name of the user, their home directory and their shell. If we leave out any of these options, it will take the defaults from this /etc/default/useradd and /etc/login.de deaths files. If we want to change the use of primary group to wheel we type in clear and then type in ansible, space rhhost2*, space…

Contents