sudoservice.sls 967 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
bugfix    
Francesco Gionghi committed
7
8
{% for user in pillar.fbkusers %}
{% if pillar.fbkusers[user]["sudoservice"] %}
9

Francesco Gionghi's avatar
bugfix    
Francesco Gionghi committed
10
{% for dir in pillar.fbkusers[user]["sudoservice"] %}
11
12
13
14
15
16
17
18
19

/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