Saltstack Official Linux 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.

38 lines
810B

  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. system_group_{{ group_name }}:
  11. group.present:
  12. - name: {{ group.get('name', group_name) }}
  13. {%- if group.system is defined and group.system %}
  14. - system: True
  15. {%- endif %}
  16. {%- if group.gid is defined and group.gid %}
  17. - gid: {{ group.gid }}
  18. {%- endif %}
  19. {{ set_p('addusers', group)|indent(2, True) }}
  20. {{ set_p('delusers', group)|indent(2, True) }}
  21. {%- else %}
  22. system_group_{{ group_name }}:
  23. group.absent:
  24. - name: {{ group.name }}
  25. {%- endif %}
  26. {%- endfor %}
  27. {%- endif %}