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.

vimrc.sls 987B

1234567891011121314151617181920212223242526272829303132333435
  1. {% from "users/map.jinja" import users with context %}
  2. {% if salt['pillar.get']('users-formula:use_vim_formula', False) %}
  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: '0644'
  25. - template: jinja
  26. - source:
  27. - salt://users/files/vimrc/{{ name }}/vimrc
  28. - salt://users/files/vimrc/vimrc
  29. {% endif %}
  30. {% endfor %}
  31. {% endif %}