--- - name: SSH configuration file ansible.builtin.template: src: sshd_config.j2 dest: /etc/ssh/sshd_config mode: 0644 notify: - Restart sshd - name: SSH keys home ansible.posix.authorized_key: user: root state: present key: "{{ lookup('file', 'ssh/home.id_rsa.pub') }}" - name: SSH keys work ansible.posix.authorized_key: user: root state: present key: "{{ lookup('file', 'ssh/work.id_rsa.pub') }}" - name: SSH keys stef ansible.posix.authorized_key: user: root state: present key: "{{ lookup('file', 'ssh/stefofficiel.id_rsa.pub') }}" path: "~/.ssh/instance_keys" when: inventory_hostname in groups['fedinupesservers']