From f7dfd1f47b6c85dfa51fbec43746e8b8a0e04d82 Mon Sep 17 00:00:00 2001 From: N Date: Tue, 12 Jun 2018 18:02:57 +0100 Subject: [PATCH] Dont force vim-formula on users --- README.rst | 2 +- pillar.example | 1 + users/defaults.yaml | 6 ++++++ users/map.jinja | 20 ++++++++++++-------- users/vimrc.sls | 5 +++++ 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 users/defaults.yaml diff --git a/README.rst b/README.rst index 43e32fd..39f9cf7 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ True' in pillar per user. Defaults to False. Ensures the vimrc file exists in the users home directory. Sets 'manage_vimrc: True' in pillar per user. Defaults to False. -This depends on the vim-formula to be installed. +This depends on the vim-formula being available and pillar `users:use_vim_formula: True`. ``users.user_files`` --------------- diff --git a/pillar.example b/pillar.example index df81335..80d28dd 100644 --- a/pillar.example +++ b/pillar.example @@ -1,4 +1,5 @@ users-formula: + use_vim_formula: True lookup: # override the defauls in map.jinja root_group: root diff --git a/users/defaults.yaml b/users/defaults.yaml new file mode 100644 index 0000000..b23d0fb --- /dev/null +++ b/users/defaults.yaml @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml + +users-formula: + use_vim_formula: False + diff --git a/users/map.jinja b/users/map.jinja index fcc573b..c5b3507 100644 --- a/users/map.jinja +++ b/users/map.jinja @@ -1,6 +1,8 @@ # vim: sts=2 ts=2 sw=2 et ai -{% set users = salt['grains.filter_by']({ +{% set users = salt['grains.filter_by']( + defaults, + merge=salt['grains.filter_by']({ 'MacOS': { 'sudoers_dir': '/etc/sudoers.d', 'sudoers_file': '/etc/sudoers', @@ -10,7 +12,7 @@ 'bash_package': 'bash', 'sudo_package': 'sudo', 'googleauth_package': 'google-authenticator-libpam', - }, + }, 'Debian': { 'sudoers_dir': '/etc/sudoers.d', 'sudoers_file': '/etc/sudoers', @@ -21,7 +23,7 @@ 'bash_package': 'bash', 'sudo_package': 'sudo', 'googleauth_package': 'libpam-google-authenticator', - }, + }, 'Gentoo': { 'sudoers_dir': '/etc/sudoers.d', 'sudoers_file': '/etc/sudoers', @@ -32,7 +34,7 @@ 'bash_package': 'app-shells/bash', 'sudo_package': 'app-admin/sudo', 'googleauth_package': 'libpam-google-authenticator', - }, + }, 'FreeBSD': { 'sudoers_dir': '/usr/local/etc/sudoers.d', 'sudoers_file': '/usr/local/etc/sudoers', @@ -43,7 +45,7 @@ 'bash_package': 'bash', 'sudo_package': 'sudo', 'googleauth_package': 'pam_google_authenticator', - }, + }, 'Solaris': { 'sudoers_dir': '/opt/local/etc/sudoers.d', 'sudoers_file': '/opt/local/etc/sudoers', @@ -54,7 +56,7 @@ 'bash_package': 'bash', 'sudo_package': 'sudo', 'googleauth_package': 'libpam-google-authenticator', - }, + }, 'default': { 'sudoers_dir': '/etc/sudoers.d', 'sudoers_file': '/etc/sudoers', @@ -65,8 +67,10 @@ 'bash_package': 'bash', 'sudo_package': 'sudo', 'googleauth_package': 'libpam-google-authenticator', - }, -}, merge=salt['pillar.get']('users-formula:lookup')) %} + }, + }, merge=salt['pillar.get']('users-formula:lookup')), + base='users', +) %} {% if grains.os == 'MacOS' %} {% set group = salt['cmd.run']("stat -f '%Sg' /dev/console") %} diff --git a/users/vimrc.sls b/users/vimrc.sls index f4d008a..d8a378d 100644 --- a/users/vimrc.sls +++ b/users/vimrc.sls @@ -1,4 +1,7 @@ {% from "users/map.jinja" import users with context %} + +{% if users.use_vim_formula %} + include: - users - vim @@ -28,3 +31,5 @@ users_{{ name }}_user_vimrc: - salt://users/files/vimrc/vimrc {% endif %} {% endfor %} + +{% endif %}