Saltstack Official Users Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435
  1. {% from "users/map.jinja" import users with context %}
  2. {% if users.use_vim_formula %}
  3. include:
  4. - users
  5. - vim
  6. {% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
  7. {%- set current = salt.user.info(name) -%}
  8. {%- if user == None -%}
  9. {%- set user = {} -%}
  10. {%- endif -%}
  11. {%- set home = user.get('home', current.get('home', "/home/%s" % name)) -%}
  12. {%- set manage = user.get('manage_vimrc', False) -%}
  13. {%- if 'prime_group' in user and 'name' in user['prime_group'] %}
  14. {%- set user_group = user.prime_group.name -%}
  15. {%- else -%}
  16. {%- set user_group = name -%}
  17. {%- endif %}
  18. {%- if manage -%}
  19. users_{{ name }}_user_vimrc:
  20. file.managed:
  21. - name: {{ home }}/.vimrc
  22. - user: {{ name }}
  23. - group: {{ user_group }}
  24. - mode: 644
  25. - template: jinja
  26. - source:
  27. - salt://users/files/vimrc/{{ name }}/vimrc
  28. - salt://users/files/vimrc/vimrc
  29. {% endif %}
  30. {% endfor %}
  31. {% endif %}