Created
August 10, 2018 07:26
-
-
Save popucui/832e190bbf83f6bf9095fc26fbd10d02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# this is a demo of how the user commands work and how to reference salted passwords | |
# in vars sections. You could also use vars_files if you like (see other examples) | |
- hosts: "193" | |
remote_user: username | |
gather_facts: no | |
vars: | |
# created with: | |
# python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")' | |
password: $1$sgi$1bXqJPs5dm6o | |
tasks: | |
# Walk through account creation, modification, and deletion | |
- name: test basic user account creation | |
user: name=tset comment=TsetUser group=users shell=/sbin/nologin createhome=no | |
# the following is just a simple example of how you don't have to include | |
# the 'name' element for each task | |
- user: name=tset comment=NyetUser | |
- user: name=tset password={{password}} | |
# The following will add the user to supplementary groups. | |
# Add the user to the groups dialout and uucp. | |
- user: name=tset groups=dialout,uucp | |
- group: name=wheel state=present | |
# Add the user to the groups dialout and wheel, | |
# This will remove tset from the group uucp. | |
- user: name=tset groups=dialout,wheel | |
# Add the user to the group uucp. Because append=yes, the user | |
# will not be removed from the groups dialout and wheel. | |
- user: name=tset groups=uucp append=yes | |
# Finally, remove the user. | |
- user: name=tset state=absent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment