0
0
mirror of https://github.com/saltstack-formulas/users-formula.git synced 2024-11-28 02:57:55 +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'] %} {% 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 %} {% if 'sudo_rules' in user %}
{% for rule in user['sudo_rules'] %} {% for rule in user['sudo_rules'] %}
"validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}": "validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}":
cmd.run: cmd.run:
- name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }' - name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }'
- stateful: True - stateful: True
- shell: {{ users.visudo_shell }} - shell: {{ users.visudo_shell }}
- env: - env:
# Specify the rule via an env var to avoid shell quoting issues. # Specify the rule via an env var to avoid shell quoting issues.
- rule: "{{ name }} {{ rule }}" - rule: "{{ name }} {{ rule }}"
@ -191,13 +185,16 @@ sudoer-{{ name }}:
{{ users.sudoers_dir }}/{{ name }}: {{ users.sudoers_dir }}/{{ name }}:
file.managed: file.managed:
- user: root
- group: {{ users.root_group }}
- mode: '0440'
- contents: | - contents: |
{%- for rule in user['sudo_rules'] %} {%- for rule in user['sudo_rules'] %}
{{ name }} {{ rule }} {{ name }} {{ rule }}
{%- endfor %} {%- endfor %}
- require: - require:
- file: sudoer-defaults - file: sudoer-defaults
- file: sudoer-{{ name }}
{% endif %} {% endif %}
{% else %} {% else %}
{{ users.sudoers_dir }}/{{ name }}: {{ users.sudoers_dir }}/{{ name }}:
@ -252,4 +249,3 @@ googleauth-{{ svc }}-{{ name }}:
{{ group }}: {{ group }}:
group.absent group.absent
{% endfor %} {% endfor %}