From 8a07ab1332457add441e3e9590457084ccd28c65 Mon Sep 17 00:00:00 2001 From: Tim Jones Date: Mon, 28 Jul 2014 16:48:08 +0000 Subject: [PATCH] Only include users.sudo when a user with sudouser is declared. --- users/init.sls | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/users/init.sls b/users/init.sls index a3440ff..e34e244 100644 --- a/users/init.sls +++ b/users/init.sls @@ -1,8 +1,6 @@ # vim: sts=2 ts=2 sw=2 et ai {% from "users/map.jinja" import users with context %} - -include: - - users.sudo +{% set used_sudo = False %} {% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %} {%- if user == None -%} @@ -127,6 +125,12 @@ ssh_auth_{{ name }}_{{ loop.index0 }}: {% if 'sudouser' in user and user['sudouser'] %} +{% if not used_sudo %} +{% set used_sudo = True %} +include: + - users.sudo +{% endif %} + sudoer-{{ name }}: file.managed: - name: {{ users.sudoers_dir }}{{ name }}