2014-05-30 05:20:13 +02:00
|
|
|
# vim: sts=2 ts=2 sw=2 et ai
|
|
|
|
{% from "users/map.jinja" import users with context %}
|
2015-01-14 18:25:17 +01:00
|
|
|
{% set used_sudo = [] %}
|
|
|
|
{% set used_googleauth = [] %}
|
|
|
|
|
2015-07-11 10:35:15 +02:00
|
|
|
{%- for name, user in pillar.get('users', {}).iteritems() if user.absent is not defined or not user.absent %}
|
2015-01-14 18:25:17 +01:00
|
|
|
{%- if user == None -%}
|
|
|
|
{%- set user = {} -%}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- if 'sudouser' in user and user['sudouser'] %}
|
|
|
|
{%- do used_sudo.append(1) %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if 'google_auth' in user %}
|
|
|
|
{%- do used_googleauth.append(1) %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
{%- if used_sudo or used_googleauth %}
|
|
|
|
include:
|
|
|
|
{%- if used_sudo %}
|
|
|
|
- users.sudo
|
|
|
|
{%- endif %}
|
|
|
|
{%- if used_googleauth %}
|
|
|
|
- users.googleauth
|
|
|
|
{%- endif %}
|
|
|
|
{%- endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
|
2015-07-11 10:35:15 +02:00
|
|
|
{% for name, user in pillar.get('users', {}).iteritems() if user.absent is not defined or not user.absent %}
|
2014-01-13 16:23:46 +01:00
|
|
|
{%- if user == None -%}
|
|
|
|
{%- set user = {} -%}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- set home = user.get('home', "/home/%s" % name) -%}
|
|
|
|
|
|
|
|
{%- if 'prime_group' in user and 'name' in user['prime_group'] %}
|
|
|
|
{%- set user_group = user.prime_group.name -%}
|
|
|
|
{%- else -%}
|
|
|
|
{%- set user_group = name -%}
|
|
|
|
{%- endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
|
|
|
|
{% for group in user.get('groups', []) %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_{{ name }}_{{ group }}_group:
|
2013-06-19 21:53:46 +02:00
|
|
|
group:
|
|
|
|
- name: {{ group }}
|
|
|
|
- present
|
|
|
|
{% endfor %}
|
|
|
|
|
2015-05-07 00:07:06 +02:00
|
|
|
users_{{ name }}_user:
|
2014-12-31 09:46:03 +01:00
|
|
|
{% if user.get('createhome', True) %}
|
2013-06-19 21:53:46 +02:00
|
|
|
file.directory:
|
|
|
|
- name: {{ home }}
|
|
|
|
- user: {{ name }}
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
2014-08-05 14:02:44 +02:00
|
|
|
- mode: {{ user.get('user_dir_mode', '0750') }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- require:
|
2015-07-13 13:51:02 +02:00
|
|
|
- user: users_{{ name }}_user
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
2014-12-22 14:32:41 +01:00
|
|
|
{%- endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
group.present:
|
2014-01-13 16:23:46 +01:00
|
|
|
- name: {{ user_group }}
|
|
|
|
{%- if 'prime_group' in user and 'gid' in user['prime_group'] %}
|
|
|
|
- gid: {{ user['prime_group']['gid'] }}
|
|
|
|
{%- elif 'uid' in user %}
|
2013-10-28 21:39:55 +01:00
|
|
|
- gid: {{ user['uid'] }}
|
2014-01-13 16:23:46 +01:00
|
|
|
{%- endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
user.present:
|
|
|
|
- name: {{ name }}
|
|
|
|
- home: {{ home }}
|
2014-09-11 17:03:14 +02:00
|
|
|
- shell: {{ user.get('shell', users.get('shell', '/bin/bash')) }}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% if 'uid' in user -%}
|
|
|
|
- uid: {{ user['uid'] }}
|
2014-01-13 16:23:46 +01:00
|
|
|
{% endif -%}
|
2014-04-25 04:45:04 +02:00
|
|
|
{% if 'password' in user -%}
|
2014-12-17 22:57:54 +01:00
|
|
|
- password: '{{ user['password'] }}'
|
2014-04-25 04:45:04 +02:00
|
|
|
{% endif -%}
|
2015-07-17 17:18:38 +02:00
|
|
|
{% if 'enforce_password' in user -%}
|
|
|
|
- enforce_password: '{{ user['enforce_password'] }}'
|
|
|
|
{% endif -%}
|
2015-03-12 23:27:31 +01:00
|
|
|
{% if user.get('system', False) -%}
|
|
|
|
- system: True
|
|
|
|
{% endif -%}
|
2014-01-13 16:23:46 +01:00
|
|
|
{% if 'prime_group' in user and 'gid' in user['prime_group'] -%}
|
|
|
|
- gid: {{ user['prime_group']['gid'] }}
|
|
|
|
{% else -%}
|
2013-06-19 21:53:46 +02:00
|
|
|
- gid_from_name: True
|
2014-01-13 16:23:46 +01:00
|
|
|
{% endif -%}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% if 'fullname' in user %}
|
|
|
|
- fullname: {{ user['fullname'] }}
|
2014-01-13 16:23:46 +01:00
|
|
|
{% endif -%}
|
2014-09-07 07:23:06 +02:00
|
|
|
{% if not user.get('createhome', True) %}
|
|
|
|
- createhome: False
|
|
|
|
{% endif %}
|
2014-12-22 14:22:46 +01:00
|
|
|
{% if 'expire' in user -%}
|
|
|
|
- expire: {{ user['expire'] }}
|
|
|
|
{% endif -%}
|
2014-10-15 04:05:00 +02:00
|
|
|
- remove_groups: {{ user.get('remove_groups', 'False') }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- groups:
|
2014-01-13 16:23:46 +01:00
|
|
|
- {{ user_group }}
|
|
|
|
{% for group in user.get('groups', []) -%}
|
|
|
|
- {{ group }}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
- require:
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
|
|
|
{% for group in user.get('groups', []) -%}
|
|
|
|
- group: {{ group }}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
|
2015-07-13 13:27:27 +02:00
|
|
|
|
2015-07-16 21:23:43 +02:00
|
|
|
{% if 'ssh_keys' in user or 'ssh_auth' in user or 'ssh_auth_file' in user or 'ssh_auth.absent' in user %}
|
2013-06-19 21:53:46 +02:00
|
|
|
user_keydir_{{ name }}:
|
|
|
|
file.directory:
|
|
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh
|
|
|
|
- user: {{ name }}
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- makedirs: True
|
2014-02-14 14:13:17 +01:00
|
|
|
- mode: 700
|
2013-06-19 21:53:46 +02:00
|
|
|
- require:
|
|
|
|
- user: {{ name }}
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
|
|
|
{%- for group in user.get('groups', []) %}
|
2013-06-19 21:53:46 +02:00
|
|
|
- group: {{ group }}
|
2014-01-13 16:23:46 +01:00
|
|
|
{%- endfor %}
|
2015-07-11 10:35:15 +02:00
|
|
|
{% endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
|
2014-01-30 03:53:09 +01:00
|
|
|
{% if 'ssh_keys' in user %}
|
2014-01-31 20:44:41 +01:00
|
|
|
{% set key_type = 'id_' + user.get('ssh_key_type', 'rsa') %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_user_{{ name }}_private_key:
|
2013-06-19 21:53:46 +02:00
|
|
|
file.managed:
|
2014-01-31 20:44:41 +01:00
|
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_type }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- user: {{ name }}
|
2014-01-13 16:23:46 +01:00
|
|
|
- group: {{ user_group }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- mode: 600
|
2014-05-13 18:37:38 +02:00
|
|
|
- show_diff: False
|
2014-02-17 05:34:47 +01:00
|
|
|
- contents_pillar: users:{{ name }}:ssh_keys:privkey
|
2013-06-19 21:53:46 +02:00
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- user: users_{{ name }}_user
|
2013-06-19 21:53:46 +02:00
|
|
|
{% for group in user.get('groups', []) %}
|
2015-05-07 00:07:06 +02:00
|
|
|
- group: users_{{ name }}_{{ group }}_group
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_user_{{ name }}_public_key:
|
2013-06-19 21:53:46 +02:00
|
|
|
file.managed:
|
2014-01-31 20:44:41 +01:00
|
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_type }}.pub
|
2013-06-19 21:53:46 +02:00
|
|
|
- user: {{ name }}
|
2014-01-30 05:00:03 +01:00
|
|
|
- group: {{ user_group }}
|
2013-06-19 21:53:46 +02:00
|
|
|
- mode: 644
|
2014-05-13 18:37:38 +02:00
|
|
|
- show_diff: False
|
2014-03-30 17:00:17 +02:00
|
|
|
- contents_pillar: users:{{ name }}:ssh_keys:pubkey
|
2013-06-19 21:53:46 +02:00
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- user: users_{{ name }}_user
|
2013-06-19 21:53:46 +02:00
|
|
|
{% for group in user.get('groups', []) %}
|
2015-05-07 00:07:06 +02:00
|
|
|
- group: users_{{ name }}_{{ group }}_group
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2015-03-13 13:32:39 +01:00
|
|
|
{% if 'ssh_auth_file' in user %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_authorized_keys_{{ name }}:
|
2015-03-13 13:32:39 +01:00
|
|
|
file.managed:
|
2015-05-07 00:07:06 +02:00
|
|
|
- name: {{ home }}/.ssh/authorized_keys
|
2015-03-13 13:32:39 +01:00
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ name }}
|
|
|
|
- mode: 600
|
|
|
|
- contents: |
|
|
|
|
{% for auth in user.ssh_auth_file -%}
|
|
|
|
{{ auth }}
|
|
|
|
{% endfor -%}
|
|
|
|
{% endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
|
2014-04-23 13:38:31 +02:00
|
|
|
{% if 'ssh_auth' in user %}
|
|
|
|
{% for auth in user['ssh_auth'] %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_ssh_auth_{{ name }}_{{ loop.index0 }}:
|
2013-06-19 21:53:46 +02:00
|
|
|
ssh_auth.present:
|
|
|
|
- user: {{ name }}
|
|
|
|
- name: {{ auth }}
|
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_{{ name }}_user
|
|
|
|
- user: users_{{ name }}_user
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2015-05-01 17:48:28 +02:00
|
|
|
{% if 'ssh_keys_pillar' in user %}
|
2015-07-13 21:22:45 +02:00
|
|
|
{% for key_name, pillar_name in user['ssh_keys_pillar'].items() %}
|
|
|
|
user_ssh_keys_files_{{ name }}_{{ key_name }}_private_key:
|
2015-05-01 17:48:28 +02:00
|
|
|
file.managed:
|
2015-07-13 21:22:45 +02:00
|
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_name }}
|
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ user_group }}
|
|
|
|
- mode: 600
|
|
|
|
- show_diff: False
|
|
|
|
- contents_pillar: {{ pillar_name }}:{{ key_name }}:privkey
|
|
|
|
- require:
|
|
|
|
- user: users_{{ name }}_user
|
|
|
|
{% for group in user.get('groups', []) %}
|
|
|
|
- group: users_{{ name }}_{{ group }}_group
|
|
|
|
{% endfor %}
|
|
|
|
user_ssh_keys_files_{{ name }}_{{ key_name }}_public_key:
|
2015-05-01 17:48:28 +02:00
|
|
|
file.managed:
|
2015-07-13 21:22:45 +02:00
|
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_name }}.pub
|
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ user_group }}
|
|
|
|
- mode: 644
|
|
|
|
- show_diff: False
|
|
|
|
- contents_pillar: {{ pillar_name }}:{{ key_name }}:pubkey
|
|
|
|
- require:
|
|
|
|
- user: users_{{ name }}_user
|
|
|
|
{% for group in user.get('groups', []) %}
|
|
|
|
- group: users_{{ name }}_{{ group }}_group
|
|
|
|
{% endfor %}
|
2015-05-01 17:48:28 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2015-04-02 19:01:30 +02:00
|
|
|
{% if 'ssh_auth_sources' in user %}
|
|
|
|
{% for pubkey_file in user['ssh_auth_sources'] %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_ssh_auth_source_{{ name }}_{{ loop.index0 }}:
|
2015-04-02 19:01:30 +02:00
|
|
|
ssh_auth.present:
|
|
|
|
- user: {{ name }}
|
|
|
|
- source: {{ pubkey_file }}
|
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_{{ name }}_user
|
|
|
|
- user: users_{{ name }}_user
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2014-08-03 01:40:27 +02:00
|
|
|
{% if 'ssh_auth.absent' in user %}
|
|
|
|
{% for auth in user['ssh_auth.absent'] %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_ssh_auth_delete_{{ name }}_{{ loop.index0 }}:
|
2014-08-03 01:40:27 +02:00
|
|
|
ssh_auth.absent:
|
|
|
|
- user: {{ name }}
|
|
|
|
- name: {{ auth }}
|
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_{{ name }}_user
|
|
|
|
- user: users_{{ name }}_user
|
2014-08-03 01:40:27 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2013-06-19 21:53:46 +02:00
|
|
|
|
2015-05-15 21:47:40 +02:00
|
|
|
{% if 'ssh_config' in user %}
|
|
|
|
users_ssh_config_{{ name }}:
|
|
|
|
file.managed:
|
|
|
|
- name: {{ home }}/.ssh/config
|
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ user_group }}
|
|
|
|
- mode: 640
|
|
|
|
- contents: |
|
|
|
|
# Managed by Saltstack
|
2015-05-16 09:56:20 +02:00
|
|
|
# Do Not Edit
|
2015-05-15 21:47:40 +02:00
|
|
|
{% for label, setting in user.ssh_config.items() %}
|
|
|
|
# {{ label }}
|
|
|
|
Host {{ setting.get('hostname') }}
|
|
|
|
{%- for opts in setting.get('options') %}
|
|
|
|
{{ opts }}
|
|
|
|
{%- endfor %}
|
|
|
|
{% endfor -%}
|
|
|
|
{% endif %}
|
|
|
|
|
2013-10-28 21:39:55 +01:00
|
|
|
{% if 'sudouser' in user and user['sudouser'] %}
|
2014-07-28 18:48:08 +02:00
|
|
|
|
2015-05-07 00:07:06 +02:00
|
|
|
users_sudoer-{{ name }}:
|
2013-10-28 21:39:55 +01:00
|
|
|
file.managed:
|
2014-10-25 04:57:44 +02:00
|
|
|
- name: {{ users.sudoers_dir }}/{{ name }}
|
2013-10-28 21:39:55 +01:00
|
|
|
- user: root
|
2015-01-23 20:52:14 +01:00
|
|
|
- group: {{ users.root_group }}
|
2013-10-28 21:39:55 +01:00
|
|
|
- mode: '0440'
|
2015-04-06 21:34:59 +02:00
|
|
|
{% if 'sudo_rules' in user or 'sudo_defaults' in user %}
|
2014-02-22 09:43:52 +01:00
|
|
|
{% if 'sudo_rules' in user %}
|
2014-04-28 16:52:43 +02:00
|
|
|
{% for rule in user['sudo_rules'] %}
|
|
|
|
"validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}":
|
|
|
|
cmd.run:
|
2014-08-03 01:06:02 +02:00
|
|
|
- name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }'
|
|
|
|
- stateful: True
|
2015-01-23 20:52:14 +01:00
|
|
|
- shell: {{ users.visudo_shell }}
|
2014-04-28 16:52:43 +02:00
|
|
|
- env:
|
|
|
|
# Specify the rule via an env var to avoid shell quoting issues.
|
|
|
|
- rule: "{{ name }} {{ rule }}"
|
|
|
|
- require_in:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_{{ users.sudoers_dir }}/{{ name }}
|
2014-04-28 16:52:43 +02:00
|
|
|
{% endfor %}
|
2015-04-06 21:34:59 +02:00
|
|
|
{% endif %}
|
|
|
|
{% if 'sudo_defaults' in user %}
|
|
|
|
{% for entry in user['sudo_defaults'] %}
|
|
|
|
"validate {{ name }} sudo Defaults {{ loop.index0 }} {{ name }} {{ entry }}":
|
|
|
|
cmd.run:
|
|
|
|
- name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }'
|
|
|
|
- stateful: True
|
|
|
|
- shell: {{ users.visudo_shell }}
|
|
|
|
- env:
|
|
|
|
# Specify the rule via an env var to avoid shell quoting issues.
|
|
|
|
- rule: "Defaults:{{ name }} {{ entry }}"
|
|
|
|
- require_in:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_{{ users.sudoers_dir }}/{{ name }}
|
2015-04-06 21:34:59 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2014-04-28 16:52:43 +02:00
|
|
|
|
2015-05-07 00:07:06 +02:00
|
|
|
users_{{ users.sudoers_dir }}/{{ name }}:
|
2014-05-13 18:36:49 +02:00
|
|
|
file.managed:
|
2015-05-07 00:07:06 +02:00
|
|
|
- name: {{ users.sudoers_dir }}/{{ name }}
|
2014-05-13 18:36:49 +02:00
|
|
|
- contents: |
|
2015-04-06 21:34:59 +02:00
|
|
|
{%- if 'sudo_defaults' in user %}
|
|
|
|
{%- for entry in user['sudo_defaults'] %}
|
|
|
|
Defaults:{{ name }} {{ entry }}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if 'sudo_rules' in user %}
|
2014-05-13 18:36:49 +02:00
|
|
|
{%- for rule in user['sudo_rules'] %}
|
|
|
|
{{ name }} {{ rule }}
|
|
|
|
{%- endfor %}
|
2015-04-06 21:34:59 +02:00
|
|
|
{%- endif %}
|
2014-02-22 09:43:52 +01:00
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- file: users_sudoer-defaults
|
|
|
|
- file: users_sudoer-{{ name }}
|
2014-02-22 09:43:52 +01:00
|
|
|
{% endif %}
|
2013-10-28 21:39:55 +01:00
|
|
|
{% else %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_{{ users.sudoers_dir }}/{{ name }}:
|
2013-10-28 21:39:55 +01:00
|
|
|
file.absent:
|
2014-10-25 04:57:44 +02:00
|
|
|
- name: {{ users.sudoers_dir }}/{{ name }}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endif %}
|
|
|
|
|
2015-01-14 18:25:17 +01:00
|
|
|
{%- if 'google_auth' in user %}
|
|
|
|
{%- for svc in user['google_auth'] %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_googleauth-{{ svc }}-{{ name }}:
|
2015-01-14 18:25:17 +01:00
|
|
|
file.managed:
|
|
|
|
- replace: false
|
|
|
|
- name: {{ users.googleauth_dir }}/{{ name }}_{{ svc }}
|
|
|
|
- contents_pillar: 'users:{{ name }}:google_auth:{{ svc }}'
|
|
|
|
- user: root
|
|
|
|
- group: {{ users.root_group }}
|
2015-07-01 17:39:53 +02:00
|
|
|
- mode: 400
|
2015-01-14 18:25:17 +01:00
|
|
|
- require:
|
2015-05-07 00:07:06 +02:00
|
|
|
- pkg: users_googleauth-package
|
2015-01-14 18:25:17 +01:00
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
|
|
|
|
2015-07-13 13:27:27 +02:00
|
|
|
|
2015-07-11 10:35:15 +02:00
|
|
|
{% for name, user in pillar.get('users', {}).iteritems() if user.absent is defined and user.absent %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_absent_user_{{ name }}:
|
2014-04-23 13:38:31 +02:00
|
|
|
{% if 'purge' in user or 'force' in user %}
|
|
|
|
user.absent:
|
2015-05-07 00:07:06 +02:00
|
|
|
- name: {{ name }}
|
2014-04-23 13:38:31 +02:00
|
|
|
{% if 'purge' in user %}
|
|
|
|
- purge: {{ user['purge'] }}
|
|
|
|
{% endif %}
|
|
|
|
{% if 'force' in user %}
|
|
|
|
- force: {{ user['force'] }}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2015-05-07 00:07:06 +02:00
|
|
|
user.absent:
|
|
|
|
- name: {{ name }}
|
2014-04-23 13:38:31 +02:00
|
|
|
{% endif -%}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_{{ users.sudoers_dir }}/{{ name }}:
|
2014-04-23 13:38:31 +02:00
|
|
|
file.absent:
|
2014-10-25 04:57:44 +02:00
|
|
|
- name: {{ users.sudoers_dir }}/{{ name }}
|
2014-04-23 13:38:31 +02:00
|
|
|
{% endfor %}
|
|
|
|
|
2013-06-19 21:53:46 +02:00
|
|
|
{% for user in pillar.get('absent_users', []) %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_absent_user_2_{{ user }}:
|
2013-06-19 21:53:46 +02:00
|
|
|
user.absent
|
2015-05-07 00:07:06 +02:00
|
|
|
users_2_{{ users.sudoers_dir }}/{{ user }}:
|
2013-10-28 21:39:55 +01:00
|
|
|
file.absent:
|
2014-10-25 04:57:44 +02:00
|
|
|
- name: {{ users.sudoers_dir }}/{{ user }}
|
2013-06-19 21:53:46 +02:00
|
|
|
{% endfor %}
|
2014-03-15 00:07:22 +01:00
|
|
|
|
|
|
|
{% for group in pillar.get('absent_groups', []) %}
|
2015-05-07 00:07:06 +02:00
|
|
|
users_absent_group_{{ group }}:
|
|
|
|
group.absent:
|
|
|
|
- name: {{ group }}
|
2014-03-15 00:07:22 +01:00
|
|
|
{% endfor %}
|