From 19a41eb84301f895029947eff51380f756292d27 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 4 Sep 2022 14:33:07 +0200 Subject: [PATCH] fix: conditionally enable groups append to avoid warnings --- tasks/users_default.yml | 2 +- tasks/users_univention.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/users_default.yml b/tasks/users_default.yml index 9b3efb7..c2e0068 100644 --- a/tasks/users_default.yml +++ b/tasks/users_default.yml @@ -10,7 +10,7 @@ user: name: "{{ item.name }}" groups: "{{ item.groups | default([]) | join(',') or omit }}" - append: yes + append: "{{ True if (item.groups | default([]) | length > 0) else False }}" password: "{{ item.password | password_hash('sha512',65534 | random(seed=inventory_hostname) | string) if item.password is defined else omit }}" shell: "{{ item.shell | default('/bin/bash') }}" loop: "{{ users_default_users }}" diff --git a/tasks/users_univention.yml b/tasks/users_univention.yml index 8bbacc3..84627c6 100644 --- a/tasks/users_univention.yml +++ b/tasks/users_univention.yml @@ -13,7 +13,7 @@ user: name: "{{ item.name }}" groups: "{{ item.groups | default([]) | join(',') or omit }}" - append: yes + append: "{{ True if (item.groups | default([]) | length > 0) else False }}" password: "{{ item.password | default(omit) | password_hash('sha512',65534 | random(seed=inventory_hostname) | string) }}" shell: "{{ item.shell | default('/bin/bash') }}" system: 'yes'