Skip to content

Instantly share code, notes, and snippets.

@colbygk
Created March 17, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colbygk/1698edafc1f9fe7344bf to your computer and use it in GitHub Desktop.
Save colbygk/1698edafc1f9fe7344bf to your computer and use it in GitHub Desktop.
- name: Setup Users
sudo: yes
user:
name: "{{ item }}"
comment: "{{ vault['linux'][item]['comment'] | default('No comment') }}"
createhome: "{{ vault['linux'][item]['createhome'] | default('yes') }}"
password: "{{ vault['linux'][item]['password'] | default('nopassword') }}"
state: "{{ vault['linux'][item]['state'] | default('present') }}"
shell: "{{ vault['linux'][item]['shell'] | default('/bin/bash') }}"
groups: "{{ vault['linux'][item]['groups'] | default(item) }}"
with_flattened:
"{{ auth_groups | default(['admin_users']) }}"
tags:
- users
@colbygk
Copy link
Author

colbygk commented Mar 17, 2016

[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{admin_users}}'). This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. [DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{developers}}'). This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

@colbygk
Copy link
Author

colbygk commented Mar 17, 2016

admin_users:
  - user1
  - user2
  - user3
  - user4

developers:
  - user5
  - user7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment