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

29 lines
816B

  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. {%- if user == None -%}
  7. {%- set user = {} -%}
  8. {%- endif -%}
  9. {%- set home = user.get('home', "/home/%s" % name) -%}
  10. {%- set manage = user.get('manage_vimrc', False) -%}
  11. {%- if 'prime_group' in user and 'name' in user['prime_group'] %}
  12. {%- set user_group = user.prime_group.name -%}
  13. {%- else -%}
  14. {%- set user_group = name -%}
  15. {%- endif %}
  16. {%- if manage -%}
  17. users_{{ name }}_user_vimrc:
  18. file.managed:
  19. - name: {{ home }}/.vimrc
  20. - user: {{ name }}
  21. - group: {{ user_group }}
  22. - mode: 644
  23. - source:
  24. - salt://users/files/vimrc/{{ name }}/vimrc
  25. - salt://users/files/vimrc/vimrc
  26. {% endif %}
  27. {% endfor %}