synchroniser.yml 24 lignes · 1086 octets
---
# Synchronisation de l'annuaire vers Samba lancée par la recette sur le contrôleur de la paire
# (D-070, service de la minuterie) : chaque tâche LSC (comptes, groupes, nettoyage) termine sans erreur.
- name: Synchronisation — repère du journal
  ansible.builtin.command: date '+%Y-%m-%d %H:%M:%S'
  register: repere_synchro
  changed_when: false
  delegate_to: "{{ paire.dc_hote }}"

- name: Synchronisation — lancer le service de la minuterie
  ansible.builtin.systemd_service:
    name: open-iam-lsc-samba.service
    state: started
  delegate_to: "{{ paire.dc_hote }}"

- name: Synchronisation — comptes, groupes et nettoyage sans erreur
  ansible.builtin.command:
    argv: [journalctl, --no-pager, -o, cat, -u, open-iam-lsc-samba.service, --since, "{{ repere_synchro.stdout }}"]
  register: journal_synchro
  changed_when: false
  failed_when: >-
    journal_synchro.stdout | regex_findall('(samba-comptes - sync|samba-groupes - sync|samba-comptes - clean) - .*errors: 0') | length != 3
    or ' ERROR ' in journal_synchro.stdout
  delegate_to: "{{ paire.dc_hote }}"