From 52ba531d63fdfad3fdd0bf0a49d2e4936a07aca7 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Tue, 10 Jul 2018 15:51:10 +0200 Subject: [PATCH] [users] add a prereq for createhome to handle the case of an absent subfolder Fixes #181 --- users/init.sls | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/users/init.sls b/users/init.sls index 015790a..4b790a8 100644 --- a/users/init.sls +++ b/users/init.sls @@ -60,6 +60,16 @@ users_{{ name }}_{{ group }}_group: {% endif %} {% endfor %} +{# in case home subfolder doesn't exist, create it before the user exists #} +{% if user.get('createhome', True) %} +users_{{ name }}_user_prereq: + file.directory: + - name: {{ home }} + - makedirs: True + - prereq: + - user: users_{{ name }}_user +{%- endif %} + users_{{ name }}_user: {% if user.get('createhome', True) %} file.directory: