fix(configuration): guard user keys access to avoid dict.keys() method collision

This commit is contained in:
2026-04-16 15:26:34 +02:00
parent 5dc0424acb
commit 6bfaa0aa2b
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@
no_log: true
- name: Ensure .ssh directory exists
when: (item.value['keys'] | default([]) | length) > 0
when: ('keys' in item.value) and (item.value['keys'] | length) > 0
ansible.builtin.file:
path: "/mnt/home/{{ item.key }}/.ssh"
state: directory
@@ -55,7 +55,7 @@
label: "{{ item.key }}"
- name: Deploy SSH authorized_keys
when: (item.value['keys'] | default([]) | length) > 0
when: ('keys' in item.value) and (item.value['keys'] | length) > 0
ansible.builtin.copy:
content: "{{ item.value['keys'] | join('\n') }}\n"
dest: "/mnt/home/{{ item.key }}/.ssh/authorized_keys"