Created
February 26, 2013 10:12
-
-
Save wu-lee/5037444 to your computer and use it in GitHub Desktop.
This file contains 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
--- # create_userA.yml tasks: | |
- name: Create the "${user}" user | |
action: user | |
state=present | |
name="${user}" | |
createhome=yes | |
- name: Insert authorized_keys for user "$user" | |
action: authorized_key | |
state=present | |
user="${user}" | |
key="${pubkey}" |
This file contains 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
--- # users.yml | |
- name: Create users | |
user: root | |
hosts: all | |
vars: | |
users: # This would be in group_vars | |
- alice | |
- bob | |
userdefs: # This would be a shared list | |
alice: | |
pubkey: sdfjwkfuqwerw | |
# More attributes here.... | |
bob: | |
pubkey: ajdfhUHFWJWRWE | |
# More attributes here.... | |
tasks: | |
- include: create_userA.yml user="${item}" pubkey="${userdefs.${item}.pubkey}" | |
with_items: ${users} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment