Merge pull request #18 from hipikat/fix-sudo_rules

Check for sudo_rules before text.append state.
This commit is contained in:
Joseph Hall 2014-02-22 06:22:35 -07:00
commit 7899704cbf
1 changed files with 9 additions and 7 deletions

View File

@ -125,15 +125,17 @@ sudoer-{{ name }}:
- user: root
- group: root
- mode: '0440'
{% if 'sudo_rules' in user %}
/etc/sudoers.d/{{ name }}:
file.append:
- text:
{% for rule in user.get('sudo_rules', []) %}
- {{ rule }}
{% for rule in user['sudo_rules'] %}
- "{{ name }} {{ rule }}"
{% endfor %}
- require:
- file: sudoer-defaults
- file: sudoer-{{ name }}
{% endif %}
{% else %}
/etc/sudoers.d/{{ name }}:
file.absent: