From 6199a6b067e2886628dc3acac5d8e5995465d901 Mon Sep 17 00:00:00 2001 From: Raoul Date: Fri, 16 Mar 2018 04:54:02 +0100 Subject: [PATCH] Automatically compose allowed users and groups lists --- readme.md | 6 ++++++ tasks/main.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/readme.md b/readme.md index 8091524..0d68cda 100644 --- a/readme.md +++ b/readme.md @@ -14,6 +14,12 @@ Variables List of groups for the `AllowGroups` keyword +Files +----- + +* `sshd.conf`: + + References ---------- diff --git a/tasks/main.yml b/tasks/main.yml index d354cbf..2f03f04 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,10 @@ --- +- name: Collect all users and groups allowed to login via ssh + set_fact: + sshd_allow_users: '{{ ["root"] + users.keys() | default({}) | sort }}' + sshd_allow_groups: '{{ ["root"] + users.keys() | default({}) | sort }}' + + - name: Copy sshd configuration template: src: sshd_config