sudoservice.sls 945 Bytes
Newer Older
1
2
3

{#- Get the `tplroot` from `tpldir` #}
{%- set fbkusersroot = slspath.split('/')[0] %}
Francesco Gionghi's avatar
Francesco Gionghi committed
4
{%- from fbkusersroot ~ "/map.jinja" import fbkuserssettings with context %}
5
6

{% if pillar.fbkusers is defined %}
Francesco Gionghi's avatar
Francesco Gionghi committed
7
{% for user, options in fbkusers %}
8
9
10
11
12
13
14
15
16
17
18
19
{% if options["sudoservice"] %}

{% for service in options["sudoservice"] %}

/etc/sudoers.d/{{ user }}-{{ service }}-alias:
  file.managed:
    - name: /etc/sudoers.d/alias-{{ service }}
    - source: salt://fbkusers/files/sudo.systemctl
    - template: jinja
    - defaults:
          user: {{ user }}
          service: {{ service }}
Francesco Gionghi's avatar
Francesco Gionghi committed
20
          servicecmd: {{ fbkuserssettings['systemctl'] }}
21
22
23
24
25
26
27
28

/etc/sudoers.d/{{ user }}-{{ service }}:
  file.managed:
    - source: salt://fbkusers/files/sudo.user
    - template: jinja
    - defaults:
          user: {{ user }}
          service: {{ service }}
Francesco Gionghi's avatar
Francesco Gionghi committed
29
          servicecmd: {{ fbkuserssettings['systemctl'] }}
30

Francesco Gionghi's avatar
update    
Francesco Gionghi committed
31
{% endfor %}
32
33
{% endif %}
{% endfor %}
Francesco Gionghi's avatar
update    
Francesco Gionghi committed
34
{% endif %}
35