Fix: When managing root user, use right dir

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-01-07 18:28:54 +01:00
parent 00916c979c
commit 7fee72eb09
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -12,7 +12,7 @@
- name: Ensure .ssh directory
file:
dest: '/home/{{ item.name }}/.ssh'
dest: '{% if item.name != "root" %}/home{% endif %}/{{ item.name }}/.ssh'
state: directory
mode: 0700
owner: '{{ item.name }}'
@ -22,7 +22,7 @@
- name: Install SSH keys for users
copy:
content: '{{ item.ssh_key }}'
dest: '/home/{{ item.name }}/.ssh/authorized_keys'
dest: '{% if item.name != "root" %}/home{% endif %}/{{ item.name }}/.ssh/authorized_keys'
mode: 0600
owner: '{{ item.name }}'
group: '{{ item.name }}'
@ -32,7 +32,7 @@
- name: Install Github SSH keys for user
get_url:
url: 'https://github.com/{{ item.github_key_user }}.keys'
dest: '/home/{{ item.name }}/.ssh/authorized_keys'
dest: '{% if item.name != "root" %}/home{% endif %}/{{ item.name }}/.ssh/authorized_keys'
force: yes
mode: 0600
owner: '{{ item.name }}'