2015-07-27 19:50:49 +02:00
|
|
|
{% from "users/map.jinja" import users with context %}
|
2018-06-12 19:02:57 +02:00
|
|
|
|
2019-11-01 08:47:15 +01:00
|
|
|
{% if salt['pillar.get']('users-formula:use_vim_formula', False) %}
|
2018-06-12 19:02:57 +02:00
|
|
|
|
2015-06-10 22:56:57 +02:00
|
|
|
include:
|
2015-07-27 19:50:49 +02:00
|
|
|
- users
|
2015-06-10 22:56:57 +02:00
|
|
|
- vim
|
|
|
|
|
2015-07-27 19:50:49 +02:00
|
|
|
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
|
2016-06-23 21:43:01 +02:00
|
|
|
{%- set current = salt.user.info(name) -%}
|
2015-07-27 19:50:49 +02:00
|
|
|
{%- if user == None -%}
|
|
|
|
{%- set user = {} -%}
|
|
|
|
{%- endif -%}
|
2016-06-23 21:43:01 +02:00
|
|
|
{%- set home = user.get('home', current.get('home', "/home/%s" % name)) -%}
|
2015-07-27 19:50:49 +02:00
|
|
|
{%- set manage = user.get('manage_vimrc', False) -%}
|
|
|
|
{%- if 'prime_group' in user and 'name' in user['prime_group'] %}
|
|
|
|
{%- set user_group = user.prime_group.name -%}
|
|
|
|
{%- else -%}
|
|
|
|
{%- set user_group = name -%}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if manage -%}
|
|
|
|
users_{{ name }}_user_vimrc:
|
|
|
|
file.managed:
|
|
|
|
- name: {{ home }}/.vimrc
|
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ user_group }}
|
|
|
|
- mode: 644
|
2016-09-22 02:02:24 +02:00
|
|
|
- template: jinja
|
|
|
|
- source:
|
2015-07-27 19:50:49 +02:00
|
|
|
- salt://users/files/vimrc/{{ name }}/vimrc
|
|
|
|
- salt://users/files/vimrc/vimrc
|
|
|
|
{% endif %}
|
2015-06-10 22:56:57 +02:00
|
|
|
{% endfor %}
|
2018-06-12 19:02:57 +02:00
|
|
|
|
|
|
|
{% endif %}
|