From 6ab398a1bbf390ca602e27d05e9bbfc71ca84a79 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 1 Aug 2018 10:54:58 +0200
Subject: [PATCH] For SFTP chrooting we need regular groups and sftp-related
 groups, they have now been added

---
 tasks/groups.yml | 10 ++++++++--
 tasks/main.yml   |  6 ++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tasks/groups.yml b/tasks/groups.yml
index 4bb6b3e..613eaea 100644
--- a/tasks/groups.yml
+++ b/tasks/groups.yml
@@ -6,5 +6,11 @@
     name: '{{ item }}'
     groups: '{{ group }}'
     append: yes
-  with_items:
-  - '{{ sftp_groups[group].user }}'
+  with_items: '{{ sftp_groups[group].user }}'
+
+- name: "Add Users to SFTP Group"
+  user:
+    name: '{{ item }}'
+    groups: 'sftp{{ group }}'
+    append: yes
+  with_items: '{{ sftp_groups[group].user }}'
diff --git a/tasks/main.yml b/tasks/main.yml
index feb1e83..a0a88f2 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -13,6 +13,12 @@
       state: 'present'
     with_items: '{{ sftp_groups }}'
 
+  - name: "Ensure SFTP Groups"
+    group:
+      name: 'sftp{{ item }}'
+      state: 'present'
+    with_items: '{{ sftp_groups }}'
+
   - name: "Ensure SFTP Base-Directory"
     file:
       dest: '{{ sftp_basepath }}'
-- 
GitLab