From 06b830f08ec97d7175ae7925160327c7d51d6be6 Mon Sep 17 00:00:00 2001 From: Joao Costa Date: Tue, 29 Jan 2019 16:12:58 +0000 Subject: [PATCH] Make location of authorized_keys file configurable --- README.md | 2 ++ defaults/main.yml | 2 ++ tasks/main.yml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f2dfb4..4678e88 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Role to manage users on a system. specified for the user. * users_create_homedirs (default: true) - create home directories for new users. Set this to false if you manage home directories separately. +* authorized_keys_file (default: .ssh/authorized_keys) - Set this if the + ssh server is configured to use a non standard authorized keys file. ## Creating users diff --git a/defaults/main.yml b/defaults/main.yml index 15c9c3d..23b8f5f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,3 +20,5 @@ users_deleted: [] # - name: developers # gid: 10000 groups_to_create: [] + +authorized_keys_file: ".ssh/authorized_keys" diff --git a/tasks/main.yml b/tasks/main.yml index ab90fbf..7ddcbd0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -33,7 +33,7 @@ authorized_key: user: "{{item.0.username}}" key: "{{item.1}}" - path: "{{ item.0.home | default('/home/' + item.0.username) }}/.ssh/authorized_keys" + path: "{{ item.0.home | default('/home/' + item.0.username) }}/{{ authorized_keys_file }}" with_subelements: - "{{users}}" - ssh_key