Skip to content

Commit

Permalink
Make location of authorized_keys file configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocosta committed Jan 29, 2019
1 parent bf466f3 commit 06b830f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ users_deleted: []
# - name: developers
# gid: 10000
groups_to_create: []

authorized_keys_file: ".ssh/authorized_keys"
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 06b830f

Please sign in to comment.