users-formula/users/vimrc.sls
Niels Abspoel b4acac9de7 Added vimrc extension to users-formula
This will ensure that a given vimrc file in a users home dir is managed
Default it will search for a vimrc in salt://users/files/vimrc/{{ username
}}/vimrc
If this isn't found it will install salt://users/files/vimrc/vimrc
2015-06-10 22:56:57 +02:00

28 lines
755 B
Plaintext

{% from "users/map.jinja" import users with context %}
include:
- users
- vim
extend:
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
{%- if user == None -%}
{%- set user = {} -%}
{%- endif -%}
{%- set home = user.get('home', "/home/%s" % name) -%}
{%- if 'prime_group' in user and 'name' in user['prime_group'] %}
{%- set user_group = user.prime_group.name -%}
{%- else -%}
{%- set user_group = name -%}
{%- endif %}
users_{{ name }}_user:
file.managed:
- name: {{ home }}/.vimrc
- owner: {{ name }}
- group: {{ user_group }}
- mode: 644
- source:
- salt://users/files/vimrc/{{ name }}/vimrc
- salt://users/files/vimrc/vimrc
{% endfor %}