0
0
mirror of https://github.com/saltstack-formulas/users-formula.git synced 2024-11-27 22:38:34 +01:00
users-formula/users/polkit.sls
2018-08-24 14:25:35 +02:00

32 lines
1.2 KiB
Plaintext

{% from "users/map.jinja" import users with context %}
{% set polkitusers = {} %}
{% set polkitusers = {'value': ''} %}
{% for name, user in pillar.get('users', {}).items() %}
{% if user.absent is not defined or not user.absent %}
{% if 'polkitadmin' in user and user['polkitadmin'] %}
{% do polkitusers.update({'value': polkitusers.value + 'unix-user:' + name + ';'}) %}
{% endif %}
{% endif %}
{% endfor %}
{% if polkitusers.value != '' %}
users_{{ users.polkit_dir }}/99salt-users-formula.conf:
file.managed:
- replace: True
- onlyif: 'test -d {{ users.polkit_dir }}'
- name: {{ users.polkit_dir }}/99salt-users-formula.conf
- contents: |
########################################################################
# File managed by Salt (users-formula).
# Your changes will be overwritten.
########################################################################
#
[Configuration]
AdminIdentities={{ users.polkit_defaults }}{{ polkitusers.value }}
{% else %}
users_{{ users.polkit_dir }}/99salt-users-formula.conf_delete:
file.absent:
- name: {{ users.polkit_dir }}/99salt-users-formula.conf
{% endif %}