30 lines
735 B
YAML
30 lines
735 B
YAML
---
|
|
- name: S'assurer que le répertoire .ssh existe
|
|
file:
|
|
path: "~/.ssh"
|
|
state: directory
|
|
mode: '0700'
|
|
|
|
- name: Ajouter la clé publique au fichier authorized_keys
|
|
ansible.posix.authorized_key:
|
|
user: root
|
|
state: present
|
|
key: "{{ lookup('file', '/home/riesjack/.ssh/ansible.pub') }}"
|
|
|
|
- name: Ajouter la clé publique au fichier authorized_keys
|
|
ansible.posix.authorized_key:
|
|
user: root
|
|
state: present
|
|
key: "{{ lookup('file', '/home/riesjack/.ssh/riesjack.pub') }}"
|
|
|
|
- name: Inject ssh config to remove open ssh root
|
|
copy:
|
|
src: ../files/sshd_config
|
|
dest: /etc/ssh/sshd_config
|
|
|
|
- name: Restart SSH service
|
|
ansible.builtin.systemd:
|
|
name: ssh
|
|
state: restarted
|
|
enabled: yes
|