diff --git a/ansible/roles/ssh_host_keys/tasks/main.yml b/ansible/roles/ssh_host_keys/tasks/main.yml index 0a9632e0db73d7023dd7dc6ebc0458e2cb1581d2..fa398387ce8a4e20cd8ee72e5766edd33930eceb 100644 --- a/ansible/roles/ssh_host_keys/tasks/main.yml +++ b/ansible/roles/ssh_host_keys/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Ensure destination directory exists only if not present - file: + ansible.builtin.file: path: /tmp/ssh_keys state: directory mode: '0755' @@ -24,12 +24,19 @@ ansible_python_interpreter: /usr/bin/python3 - name: Unpack SSH host keys to /etc/ssh - unarchive: + ansible.builtin.unarchive: src: "/tmp/ssh_keys/{{ SSH_HOST_KEYS_S3_OBJECT }}" dest: "/etc/ssh" + group: root + owner: root remote_src: yes become: true +- name: Remove the temporary folder after put in place + ansible.builtin.file: + path: /tmp/ssh_keys + state: absent + - name: Restart SSH service ansible.builtin.service: name: sshd