From 9d57419bf50ecf16eb67606f4998fca9f9861e1c Mon Sep 17 00:00:00 2001 From: Jonathan Piron Date: Thu, 3 Aug 2017 18:44:42 +0200 Subject: [PATCH] Add append sftp_users configuration option A sftp user may belong to other groups. --- README.md | 2 ++ tasks/main.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 596ad72..8360d03 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The following role variables are relevant: * `shell`: Boolean indicating if the user should have a shell access (default to `True`). * `authorized`: An optional list of files placed in `files/` which contain valid public keys for the SFTP user. * `sftp_directories`: A list of directories that need to be individually created for an SFTP user. Defaults to a blank list (i.e. "[]"). + * `append`: Boolean to add `sftp_group_name` to the user groups (if any) instead of setting it (defaut to `False`). ## Example Playbook @@ -55,6 +56,7 @@ The following role variables are relevant: - name: sally password: "" authorized: [sally.pub] + append: True - sftp_directories: - imports - exports diff --git a/tasks/main.yml b/tasks/main.yml index 75fba3c..8f8d3c4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,6 +48,7 @@ user: name: "{{ item.name }}" groups: "{{ sftp_group_name }}" + append: "{{ item.append | default(False) }}" home: "{{ sftp_home_partition }}/{{ item.name }}" # `None` means default value -> default is to have a shell shell: "{{ None if (item.shell | default(True)) else '/sbin/nologin' }}"