Manage Aegis SSH authorized key fragments

This commit is contained in:
Fabio Scotto di Santolo
2026-09-13 14:46:08 +02:00
parent b05a2b4e74
commit a347880d4c
2 changed files with 26 additions and 10 deletions

View File

@@ -165,14 +165,27 @@
path: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys"
register: aegis_authorized_keys
- name: Manage Aegis SSH authorized keys
- name: Ensure Aegis SSH authorized key fragments directory exists
tags: [aegis, ssh, services]
ansible.posix.authorized_key:
user: "{{ ansible_user }}"
key: "{{ aegis_ssh_authorized_keys | join('\n') }}"
state: present
exclusive: true
manage_dir: true
ansible.builtin.file:
path: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys.d"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0700"
when: aegis_ssh_authorized_keys | length > 0
- name: Manage Aegis SSH authorized key fragments
tags: [aegis, ssh, services]
ansible.builtin.copy:
content: "{{ item.key }}\n"
dest: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys.d/{{ item.name }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0600"
loop: "{{ aegis_ssh_authorized_keys }}"
loop_control:
label: "{{ item.name }}"
when: aegis_ssh_authorized_keys | length > 0
- name: Find Aegis SSH authorized key fragments