2015-01-01 23:14:56 +01:00
|
|
|
{% from "sudoers/map.jinja" import sudoers with context %}
|
2013-08-20 23:32:58 +02:00
|
|
|
|
|
|
|
sudo:
|
|
|
|
pkg.installed:
|
2015-01-01 23:19:47 +01:00
|
|
|
- name: {{ sudoers.pkg }}
|
2013-08-20 23:32:58 +02:00
|
|
|
|
2018-08-22 12:14:02 +02:00
|
|
|
{% if salt['pillar.get']('sudoers:manage_main_config', True) %}
|
|
|
|
|
2017-08-16 14:32:42 +02:00
|
|
|
{{ sudoers.get('configpath', '/etc') }}/sudoers:
|
2013-08-20 23:32:58 +02:00
|
|
|
file.managed:
|
|
|
|
- user: root
|
2015-01-01 23:14:56 +01:00
|
|
|
- group: {{ sudoers.get('group', 'root') }}
|
2013-08-20 23:32:58 +02:00
|
|
|
- mode: 440
|
|
|
|
- template: jinja
|
|
|
|
- source: salt://sudoers/files/sudoers
|
2017-08-16 14:32:42 +02:00
|
|
|
- check_cmd: {{ sudoers.get('execprefix', '/usr/sbin') }}/visudo -c -f
|
2014-02-09 18:32:22 +01:00
|
|
|
- context:
|
|
|
|
included: False
|
2013-08-20 23:32:58 +02:00
|
|
|
- require:
|
|
|
|
- pkg: sudo
|
2018-08-22 12:14:02 +02:00
|
|
|
|
|
|
|
{% else %}
|
|
|
|
|
|
|
|
{{ sudoers.get('configpath', '/etc') }}/sudoers:
|
|
|
|
test.show_notification:
|
|
|
|
- name: Skipping management of main sudoers file
|
|
|
|
- text: Pillar manage_main_config is False
|
|
|
|
|
|
|
|
{% endif %}
|