Skip to content

Instantly share code, notes, and snippets.

@ryan-lane
Last active January 11, 2020 22:54
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 ryan-lane/a6d1786bf54b32541ab2 to your computer and use it in GitHub Desktop.
Save ryan-lane/a6d1786bf54b32541ab2 to your computer and use it in GitHub Desktop.
user state example
users:
testuser:
full_name: Test User
id: 1001
disabled: False
Ensure human user testuser exist:
user.present:
- name: testuser
- uid: 1001
- gid_from_name: True
- shell: /bin/bash
- createhome: True
- password: '*'
- fullname: Test User
{% for name, user in pillar['users'].items() %}
Ensure human user {{ name }} exist:
user.present:
- name: {{ name }}
- uid: {{ user.id }}
- gid_from_name: True
- shell: /bin/bash
- createhome: True
- password: '*'
- fullname: {{ user.full_name }}
{% if 'disabled' in user and user.disabled %}
- expire: 1
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment