2012-03-22 19:36:11 +01:00
|
|
|
---
|
2012-03-22 05:33:10 +01:00
|
|
|
# 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)
|
|
|
|
|
2012-03-22 19:36:11 +01:00
|
|
|
- hosts: all
|
|
|
|
user: root
|
|
|
|
vars:
|
|
|
|
# created with:
|
2013-03-05 21:39:28 +01:00
|
|
|
# python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")'
|
2012-03-22 19:36:11 +01:00
|
|
|
password: $1$SomeSalt$UqddPX3r4kH3UL5jq5/ZI.
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
# Walk through account creation, modification, and deletion
|
|
|
|
- name: test basic user account creation
|
2012-03-28 23:24:13 +02:00
|
|
|
action: user name=tset comment=TsetUser group=users shell=/sbin/nologin createhome=no
|
2012-03-22 19:36:11 +01:00
|
|
|
|
2012-03-24 02:06:54 +01:00
|
|
|
# the following is just a simple example of how you don't have to include
|
|
|
|
# the 'name' element for each task
|
2012-03-22 19:36:11 +01:00
|
|
|
|
2012-03-24 02:06:54 +01:00
|
|
|
- action: user name=tset comment=NyetUser
|
2012-03-28 23:50:26 +02:00
|
|
|
- action: user name=tset password=$password
|
2012-03-28 23:24:13 +02:00
|
|
|
|
|
|
|
# The following will add the user to supplementary groups.
|
|
|
|
|
|
|
|
# Add the user to the groups dialout and uucp.
|
|
|
|
- action: user name=tset groups=dialout,uucp
|
|
|
|
|
|
|
|
# Add the user to the groups dialout and wheel,
|
|
|
|
# This will remove tset from the group uucp.
|
|
|
|
- action: 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.
|
|
|
|
- action: user name=tset groups=uucp append=yes
|
|
|
|
|
|
|
|
# Finally, remove the user.
|
2012-03-24 02:06:54 +01:00
|
|
|
- action: user name=tset state=absent
|