infra/roles/common/tasks/peers.yml

24 lines
762 B
YAML

- name: Créer un compte pour le serveur pair
user:
name: "{{ item.name }}"
state: present
skeleton: /etc/skel
shell: /bin/bash
system: no
createhome: yes
home: "/home/peers/{{ item.name }}"
- name: Configurer la clé autorisée pour le serveur pair
lineinfile:
path: "/home/peers/{{ item.name }}/.ssh/authorized_keys"
line: "{{ item.client_key }}"
create: yes
# TODO: dans authorized_keys pour restreindre le compte à SCP
# no-port-forwarding,no-pty,command="scp source target" ssh-dss ...
# TODO: chroot
- name: Configurer le known_hosts du compte peer pour le serveur pair
lineinfile:
path: /home/peers/self/.ssh/known_hosts
create: yes
line: "{{ item.name }} {{ item.server_key }}"