From 2d68ec51dea337ffea61507b36143fc4435d4568 Mon Sep 17 00:00:00 2001 From: Johanna Dorothea Reichmann Date: Wed, 31 Aug 2022 11:09:37 +0200 Subject: [PATCH] feat(user): allow controlling what the user role should do --- roles/user/tasks/main.yml | 1 + roles/user/tasks/user.yml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/user/tasks/main.yml b/roles/user/tasks/main.yml index 80b049a..29833bd 100644 --- a/roles/user/tasks/main.yml +++ b/roles/user/tasks/main.yml @@ -20,4 +20,5 @@ owner: root mode: 0440 validate: "/usr/sbin/visudo -cf %s" + when: user_template_sudoers | default(true) become: yes diff --git a/roles/user/tasks/user.yml b/roles/user/tasks/user.yml index 6286fd3..0288bff 100644 --- a/roles/user/tasks/user.yml +++ b/roles/user/tasks/user.yml @@ -1,9 +1,9 @@ - name: "create user {{ user.name }}" user: name: "{{ user.name }}" - shell: "/bin/bash" - groups: [] - comment: "{{ user.gecos | default(omit) }}" + shell: "{{ user_set_shell | default(true) | ternary(user.shell | default('/bin/bash'), omit) }}" + groups: "{{ user_set_groups | default(true) | ternary(user.groups | default([]), omit) }}" + comment: "{{ user_set_gecos | default(true) | ternary(user.gecos | default(omit), omit) }}" become: yes - name: "add ssh key for {{ user.name }}"