Saltstack Official Users Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

30 lines
880B

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