Saltstack Official Users Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

polkit.sls 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. {% from "users/map.jinja" import users with context %}
  2. {% set polkitusers = {} %}
  3. {% set polkitusers = {'value': ''} %}
  4. {% for name, user in pillar.get('users', {}).items() %}
  5. {% if user.absent is not defined or not user.absent %}
  6. {% if 'polkitadmin' in user and user['polkitadmin'] %}
  7. {% if polkitusers.update({'value': polkitusers.value + 'unix-user:' + name + ';'}) %}
  8. {% endif %}
  9. {% endif %}
  10. {% endif %}
  11. {% endfor %}
  12. {% if polkitusers.value != '' %}
  13. users_{{ users.polkit_dir }}/99salt-users-formula.conf:
  14. file.managed:
  15. - replace: True
  16. - onlyif: 'test -d {{ users.polkit_dir }}'
  17. - name: {{ users.polkit_dir }}/99salt-users-formula.conf
  18. - contents: |
  19. ########################################################################
  20. # File managed by Salt (users-formula).
  21. # Your changes will be overwritten.
  22. ########################################################################
  23. #
  24. [Configuration]
  25. AdminIdentities={{ users.polkit_defaults }}{{ polkitusers.value }}
  26. {% else %}
  27. users_{{ users.polkit_dir }}/99salt-users-formula.conf_delete:
  28. file.absent:
  29. - name: {{ users.polkit_dir }}/99salt-users-formula.conf
  30. {% endif %}