Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

46 rindas
1.0KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- macro set_p(paramname, dictvar) -%}
  4. {%- if paramname in dictvar -%}
  5. - {{ paramname }}: {{ dictvar[paramname] }}
  6. {%- endif -%}
  7. {%- endmacro -%}
  8. {%- for group_name, group in system.group.iteritems() %}
  9. {%- if group.enabled %}
  10. {%- set requires = [] %}
  11. {%- for user in group.get('addusers', []) %}
  12. {%- if user in system.get('user', {}).keys() %}
  13. {%- do requires.append({'user': 'system_user_'+user}) %}
  14. {%- endif %}
  15. {%- endfor %}
  16. system_group_{{ group_name }}:
  17. group.present:
  18. - name: {{ group.get('name', group_name) }}
  19. {%- if group.system is defined and group.system %}
  20. - system: True
  21. {%- endif %}
  22. {%- if group.gid is defined and group.gid %}
  23. - gid: {{ group.gid }}
  24. {%- endif %}
  25. - require: {{ requires|yaml }}
  26. {{ set_p('addusers', group)|indent(2, True) }}
  27. {{ set_p('delusers', group)|indent(2, True) }}
  28. {%- else %}
  29. system_group_{{ group_name }}:
  30. group.absent:
  31. - name: {{ group.name }}
  32. {%- endif %}
  33. {%- endfor %}
  34. {%- endif %}