sudocmd.sls 571 Bytes
Newer Older
Francesco Gionghi's avatar
update  
Francesco Gionghi committed
1
2
3

{#- Get the `tplroot` from `tpldir` #}
{%- set fbkusersroot = slspath.split('/')[0] %}
Francesco Gionghi's avatar
bugfix    
Francesco Gionghi committed
4
{%- from fbkusersroot ~ "/map.jinja" import fbkusers with context %}
Francesco Gionghi's avatar
update  
Francesco Gionghi committed
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]["sudocmd"] %}
Francesco Gionghi's avatar
update  
Francesco Gionghi committed
9
10
11
12
13
14
15
16

/etc/sudoers.d/{{ user }}-cmd:
  file.managed:
    - name: /etc/sudoers.d/{{ user }}-cmd
    - source: salt://fbkusers/files/sudo.cmd
    - template: jinja
    - defaults:
        sudouser: {{ user }}
Francesco Gionghi's avatar
bugfix    
Francesco Gionghi committed
17
        myaccumulator: {{ pillar.fbkusers[user]["sudocmd"] }}
Francesco Gionghi's avatar
update  
Francesco Gionghi committed
18
19
20
21

{% endif %}
{% endfor %}
{% endif %}