Merge pull request #18 from hipikat/fix-sudo_rules
Check for sudo_rules before text.append state.
This commit is contained in:
commit
7899704cbf
@ -125,15 +125,17 @@ sudoer-{{ name }}:
|
|||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
- mode: '0440'
|
- mode: '0440'
|
||||||
|
{% if 'sudo_rules' in user %}
|
||||||
/etc/sudoers.d/{{ name }}:
|
/etc/sudoers.d/{{ name }}:
|
||||||
file.append:
|
file.append:
|
||||||
- text:
|
- text:
|
||||||
{% for rule in user.get('sudo_rules', []) %}
|
{% for rule in user['sudo_rules'] %}
|
||||||
- {{ rule }}
|
- "{{ name }} {{ rule }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
- require:
|
- require:
|
||||||
- file: sudoer-defaults
|
- file: sudoer-defaults
|
||||||
- file: sudoer-{{ name }}
|
- file: sudoer-{{ name }}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
/etc/sudoers.d/{{ name }}:
|
/etc/sudoers.d/{{ name }}:
|
||||||
file.absent:
|
file.absent:
|
||||||
|
Loading…
Reference in New Issue
Block a user