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.

пре 9 година
пре 7 година
пре 9 година
пре 9 година
пре 7 година
пре 9 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.items() %}
  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. {%- if group.members is defined %}
  20. - members: {{ group.members|json }}
  21. {%- else %}
  22. {%- set requires = [] %}
  23. {%- for user in group.get('addusers', []) %}
  24. {%- if user in system.get('user', {}).keys() %}
  25. {%- do requires.append({'user': 'system_user_'+user}) %}
  26. {%- endif %}
  27. {%- endfor %}
  28. - require: {{ requires|yaml }}
  29. {{ set_p('addusers', group)|indent(2, True) }}
  30. {{ set_p('delusers', group)|indent(2, True) }}
  31. {% endif %}
  32. {%- else %}
  33. system_group_{{ group_name }}:
  34. group.absent:
  35. - name: {{ group.name }}
  36. {%- endif %}
  37. {%- endfor %}
  38. {%- endif %}