From 2fa5c1fb6a959c3969fcd52cbdd1ab61eccd8289 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 24 Dec 2022 17:50:27 +0100 Subject: [PATCH] updated users state --- states/users/init.sls | 2 +- states/users/{ssh-keys.sls => sshkeys.sls} | 0 states/users/users.sls | 10 +++------- 3 files changed, 4 insertions(+), 8 deletions(-) rename states/users/{ssh-keys.sls => sshkeys.sls} (100%) diff --git a/states/users/init.sls b/states/users/init.sls index dbdf2af..2001e6d 100644 --- a/states/users/init.sls +++ b/states/users/init.sls @@ -2,4 +2,4 @@ include: - .groups - .users - - .ssh-keys + - .sshkeys diff --git a/states/users/ssh-keys.sls b/states/users/sshkeys.sls similarity index 100% rename from states/users/ssh-keys.sls rename to states/users/sshkeys.sls diff --git a/states/users/users.sls b/states/users/users.sls index 59a42a9..da11140 100644 --- a/states/users/users.sls +++ b/states/users/users.sls @@ -2,7 +2,7 @@ {%- from "users/map.jinja" import users with context -%} {%- for name, user in users.items() %} - +{%- if "sys" in user.roles %} {%- if not user.enabled %} user-{{ name }}: user.absent: @@ -20,12 +20,7 @@ user-{{ name }}: - hash_password: true - gid: {{ user.gid }} - allow_gid_change: true - {%- if user.optional_groups is defined %} - - optional_groups: - {%- for opt_group in user.optional_groups %} - - {{ opt_group }} - {%- endfor %} - {%- endif %} + {% if user.optional_groups is defined %}- optional_groups: {{ user.optional_groups }}{% endif %} user-{{ name }}-config-dir: file.directory: @@ -34,5 +29,6 @@ user-{{ name }}-config-dir: - group: {{ user.gid }} - mode: 0755 {%- endif %} +{%- endif %} {% endfor %}