From d03df1994dd5b4fc449bed80a48cff17eab5126f Mon Sep 17 00:00:00 2001 From: Lilian Roller Date: Wed, 27 Mar 2019 14:23:41 +0100 Subject: [PATCH] allow dynamic user configuration --- README.md | 1 + defaults/main.yml | 5 +++++ tasks/main.yml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5403255..29582d5 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ users: - ottojo@uni - ottojo@home ``` +*have a look into defaults/main.yml foraditionally informations!* Files ----- diff --git a/defaults/main.yml b/defaults/main.yml index 5c7f89b..4cb9287 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,8 @@ --- +# default users for SSH access +sshd_default_allowed_users: + - "root" + - "ansible" + # Enable AllowUsers and AllowGroups options restrict_allow_users: True diff --git a/tasks/main.yml b/tasks/main.yml index 43f2f0b..97b2fc1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,7 +15,7 @@ - name: Collect all users and groups allowed to login via ssh set_fact: - sshd_allow_users: '{{ ["root", "ansible"] + users.keys() | default({}) | sort }}' + sshd_allow_users: '{{ sshd_default_allowed_users + users.keys() | default({}) | sort }}' sshd_allow_groups: '{{ ["root", "admins"] + users.keys() | default({}) | sort }}'