Merge pull request #26 from slawekp/master
New format of handling user.absent, supporting additional parameters
This commit is contained in:
commit
7cefc9e601
@ -1,8 +1,7 @@
|
|||||||
users:
|
users:
|
||||||
## Minimal required pillar values
|
## Minimal required pillar values
|
||||||
auser:
|
auser:
|
||||||
groups:
|
fullname: A User
|
||||||
- admin
|
|
||||||
|
|
||||||
## Full list of pillar values
|
## Full list of pillar values
|
||||||
buser:
|
buser:
|
||||||
@ -25,6 +24,14 @@ users:
|
|||||||
ssh_auth:
|
ssh_auth:
|
||||||
- PUBLICKEY
|
- PUBLICKEY
|
||||||
|
|
||||||
|
## Absent user
|
||||||
|
cuser:
|
||||||
|
absent: True
|
||||||
|
purge: True
|
||||||
|
force: True
|
||||||
|
|
||||||
|
|
||||||
|
## Old syntax of absent_users still supported
|
||||||
absent_users:
|
absent_users:
|
||||||
- donald
|
- donald
|
||||||
- bad_guy
|
- bad_guy
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
include:
|
include:
|
||||||
- users.sudo
|
- users.sudo
|
||||||
|
|
||||||
{% for name, user in pillar.get('users', {}).items() %}
|
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
|
||||||
{%- if user == None -%}
|
{%- if user == None -%}
|
||||||
{%- set user = {} -%}
|
{%- set user = {} -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
@ -144,6 +144,24 @@ sudoer-{{ name }}:
|
|||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for name, user in pillar.get('users', {}).items() if user.absent is defined and user.absent %}
|
||||||
|
{{ name }}:
|
||||||
|
{% if 'purge' in user or 'force' in user %}
|
||||||
|
user.absent:
|
||||||
|
{% if 'purge' in user %}
|
||||||
|
- purge: {{ user['purge'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'force' in user %}
|
||||||
|
- force: {{ user['force'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
user.absent
|
||||||
|
{% endif -%}
|
||||||
|
/etc/sudoers.d/{{ name }}:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/sudoers.d/{{ name }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% for user in pillar.get('absent_users', []) %}
|
{% for user in pillar.get('absent_users', []) %}
|
||||||
{{ user }}:
|
{{ user }}:
|
||||||
user.absent
|
user.absent
|
||||||
|
Loading…
Reference in New Issue
Block a user