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 880B

1234567891011121314151617181920212223242526272829
  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 %}