modified visudo to only report change in salt when there is an error.

This commit is contained in:
7oku 2014-08-03 01:06:02 +02:00
parent 93e3c15096
commit 94d53d5ee7

View File

@ -141,7 +141,8 @@ sudoer-{{ name }}:
{% for rule in user['sudo_rules'] %}
"validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}":
cmd.run:
- name: 'visudo -cf - <<<"$rule"'
- name: 'visudo -cf - <<<"$rule" | { read output; if [[ $output != "stdin: parsed OK" ]] ; then echo $output ; fi }'
- stateful: True
- shell: {{ users.visudo_shell }}
- env:
# Specify the rule via an env var to avoid shell quoting issues.