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.

6 vuotta sitten
12345678910111213141516171819202122232425262728293031
  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. {% do polkitusers.update({'value': polkitusers.value + 'unix-user:' + name + ';'}) %}
  8. {% endif %}
  9. {% endif %}
  10. {% endfor %}
  11. {% if polkitusers.value != '' %}
  12. users_{{ users.polkit_dir }}/99salt-users-formula.conf:
  13. file.managed:
  14. - replace: True
  15. - onlyif: 'test -d {{ users.polkit_dir }}'
  16. - name: {{ users.polkit_dir }}/99salt-users-formula.conf
  17. - contents: |
  18. ########################################################################
  19. # File managed by Salt (users-formula).
  20. # Your changes will be overwritten.
  21. ########################################################################
  22. #
  23. [Configuration]
  24. AdminIdentities={{ users.polkit_defaults }}{{ polkitusers.value }}
  25. {% else %}
  26. users_{{ users.polkit_dir }}/99salt-users-formula.conf_delete:
  27. file.absent:
  28. - name: {{ users.polkit_dir }}/99salt-users-formula.conf
  29. {% endif %}