0
0
mirror of https://github.com/saltstack-formulas/users-formula.git synced 2024-11-28 00:48:22 +01:00

Avoid the "Neither 'source' nor 'contents' nor 'contents_pillar' nor 'contents_grains' was defined, yet 'replace' was set to 'True'." Warning

i don't understand why you'd want to deal with the same file in two different places anyway.
This commit is contained in:
Shawn Butts 2015-03-04 12:41:04 -05:00
parent e39a9537ba
commit e86a0dcfc1

View File

@ -169,19 +169,13 @@ ssh_auth_delete_{{ name }}_{{ loop.index0 }}:
{% if 'sudouser' in user and user['sudouser'] %}
sudoer-{{ name }}:
file.managed:
- name: {{ users.sudoers_dir }}/{{ name }}
- user: root
- group: {{ users.root_group }}
- mode: '0440'
{% if 'sudo_rules' in user %}
{% for rule in user['sudo_rules'] %}
"validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}":
cmd.run:
- name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }'
- stateful: True
- shell: {{ users.visudo_shell }}
- shell: {{ users.visudo_shell }}
- env:
# Specify the rule via an env var to avoid shell quoting issues.
- rule: "{{ name }} {{ rule }}"
@ -191,13 +185,16 @@ sudoer-{{ name }}:
{{ users.sudoers_dir }}/{{ name }}:
file.managed:
- user: root
- group: {{ users.root_group }}
- mode: '0440'
- contents: |
{%- for rule in user['sudo_rules'] %}
{{ name }} {{ rule }}
{%- endfor %}
- require:
- file: sudoer-defaults
- file: sudoer-{{ name }}
{% endif %}
{% else %}
{{ users.sudoers_dir }}/{{ name }}:
@ -252,4 +249,3 @@ googleauth-{{ svc }}-{{ name }}:
{{ group }}:
group.absent
{% endfor %}