From b94514529dad9edeefe2032740d7632b48c75579 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 30 Dec 2015 03:31:57 +0000 Subject: [PATCH] Display "managed by Salt" header in user sudoers files --- users/init.sls | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/users/init.sls b/users/init.sls index 87b0ce8..8f22374 100644 --- a/users/init.sls +++ b/users/init.sls @@ -384,6 +384,11 @@ users_{{ users.sudoers_dir }}/{{ name }}: {%- endfor %} {%- endif %} {%- if 'sudo_rules' in user %} + ######################################################################## + # File managed by Salt (users-formula). + # Your changes will be overwritten. + ######################################################################## + # {%- for rule in user['sudo_rules'] %} {{ name }} {{ rule }} {%- endfor %} @@ -391,10 +396,10 @@ users_{{ users.sudoers_dir }}/{{ name }}: - require: - file: users_sudoer-defaults - file: users_sudoer-{{ name }} - cmd.wait: + cmd.wait: - name: visudo -cf {{ users.sudoers_dir }}/{{ name }} || ( rm -rvf {{ users.sudoers_dir }}/{{ name }}; exit 1 ) - - watch: - - file: {{ users.sudoers_dir }}/{{ name }} + - watch: + - file: {{ users.sudoers_dir }}/{{ name }} {% endif %} {% else %} users_{{ users.sudoers_dir }}/{{ name }}: