79 lines
2.7 KiB
YAML
79 lines
2.7 KiB
YAML
|
|
---
|
||
|
|
# CE NOEUD VERIFIE SON PROPRE DEPOT DISTANT.
|
||
|
|
#
|
||
|
|
# Inclus seulement quand un `serveur_icinga` existe dans l'ecosysteme : sans destinataire,
|
||
|
|
# le rapport n'irait nulle part, et poser un timer qui echoue chaque nuit apprendrait aux
|
||
|
|
# gens a ignorer une unite rouge.
|
||
|
|
- name: Exiger de quoi rapporter à Icinga
|
||
|
|
ansible.builtin.assert:
|
||
|
|
that:
|
||
|
|
- client_backup_icinga_motdepasse | length > 0
|
||
|
|
fail_msg: >-
|
||
|
|
`vault_icinga_api_depot` requis : un hôte `serveur_icinga` existe, mais aucun
|
||
|
|
secret d'API. Le nœud verrait l'état de son dépôt sans pouvoir le dire.
|
||
|
|
|
||
|
|
- name: Déposer le mot de passe d'API Icinga
|
||
|
|
ansible.builtin.copy:
|
||
|
|
content: "{{ client_backup_icinga_motdepasse }}\n"
|
||
|
|
dest: /etc/setops/icinga-api.pass
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0600"
|
||
|
|
no_log: true
|
||
|
|
|
||
|
|
# L'AC d'ICINGA, PAS CELLE DE step-ca : Icinga refuse de servir un certificat qu'il n'a
|
||
|
|
# pas émis (il renouvelle tout ce qui expire sous 30 jours, nos certificats vivent 24 h).
|
||
|
|
# Domaine de confiance fermé, pair authentifié malgré tout — ce qui était le vrai enjeu.
|
||
|
|
- name: L'AC d'Icinga est-elle déjà disponible ?
|
||
|
|
ansible.builtin.stat:
|
||
|
|
path: "{{ client_backup_icinga_ca_source }}"
|
||
|
|
delegate_to: "{{ client_backup_icinga_hote }}"
|
||
|
|
register: client_backup_ca_presente
|
||
|
|
|
||
|
|
- name: Récupérer l'AC d'Icinga depuis l'hôte de supervision
|
||
|
|
when: client_backup_ca_presente.stat.exists
|
||
|
|
ansible.builtin.slurp:
|
||
|
|
src: "{{ client_backup_icinga_ca_source }}"
|
||
|
|
delegate_to: "{{ client_backup_icinga_hote }}"
|
||
|
|
register: client_backup_ca_icinga
|
||
|
|
|
||
|
|
- name: Déposer l'AC d'Icinga pour la vérification du pair
|
||
|
|
when: client_backup_ca_presente.stat.exists
|
||
|
|
ansible.builtin.copy:
|
||
|
|
content: "{{ client_backup_ca_icinga.content | b64decode }}"
|
||
|
|
dest: "{{ client_backup_ca_verification }}"
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0644"
|
||
|
|
|
||
|
|
- name: Installer curl pour le rapport passif
|
||
|
|
ansible.builtin.apt:
|
||
|
|
name: curl
|
||
|
|
state: present
|
||
|
|
|
||
|
|
- name: Déployer le contrôle de mon dépôt
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: verifier-mon-depot.sh.j2
|
||
|
|
dest: /usr/local/sbin/setops-verifier-mon-depot.sh
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0700"
|
||
|
|
|
||
|
|
- name: Déployer l'unité et le timer de vérification
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: "{{ item.s }}"
|
||
|
|
dest: "/etc/systemd/system/{{ item.d }}"
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0644"
|
||
|
|
loop:
|
||
|
|
- { s: setops-verification-depot.service.j2, d: setops-verification-depot.service }
|
||
|
|
- { s: setops-verification-depot.timer.j2, d: setops-verification-depot.timer }
|
||
|
|
|
||
|
|
- name: Activer le timer de vérification
|
||
|
|
ansible.builtin.systemd_service:
|
||
|
|
name: setops-verification-depot.timer
|
||
|
|
enabled: true
|
||
|
|
state: started
|
||
|
|
daemon_reload: true
|