mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
A handler name was doing two jobs at once: the line an operator reads in the
play output, and the identifier a `notify:` binds to. The two pull in opposite
directions -- the log wants "restart the SSH service, with diagnostics", the
binding wants a token that survives quoting, YAML flow style and a shell
round-trip -- and a name that changes for readability silently changes which
handler runs.
Every handler that a notify reached by name now carries a `listen:` with that
exact wording, so the binding is explicit before anything is renamed. The
topics themselves become identifiers: `compose up` reads `compose-up`,
`Restart NFS ganesha` reads `restart-nfs-ganesha`, 22 of them across both
sides of every notify. Where the topic is assembled at runtime, both branches
moved together: the conditional in sys-service carries two literals, and the
LDAP renderer interpolates `import-{{ folder }}-ldif-files`, which is what
makes those handlers reachable at all.
Freed from the binding, the names take the emoji prefix every other task line
already has.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
61 lines
2.5 KiB
YAML
61 lines
2.5 KiB
YAML
---
|
||
- name: 🔌 Load memberof module in OpenLDAP (cn=config via EXTERNAL)
|
||
ansible.builtin.shell: >-
|
||
container exec -i {{ lookup('container_address', 'svc-db-openldap', 'openldap') }}
|
||
ldapmodify -Q -Y EXTERNAL -H {{ OPENLDAP_CONFIG_URI }}
|
||
-f "{{ [OPENLDAP_LDIF_PATH_DOCKER, 'configuration/01_member_of_configuration.ldif'] | path_join }}"
|
||
listen:
|
||
- "import-configuration-ldif-files"
|
||
register: r
|
||
failed_when: >-
|
||
r.rc != 0 and
|
||
not (r.stderr | default('') | ldap_modify_noop)
|
||
|
||
- name: 🔌 Load refint module in OpenLDAP (cn=config via EXTERNAL)
|
||
ansible.builtin.shell: >-
|
||
container exec -i {{ lookup('container_address', 'svc-db-openldap', 'openldap') }}
|
||
ldapmodify -Q -Y EXTERNAL -H {{ OPENLDAP_CONFIG_URI }}
|
||
-f "{{ [OPENLDAP_LDIF_PATH_DOCKER, 'configuration/04_refint_module.ldif'] | path_join }}"
|
||
listen:
|
||
- "import-configuration-ldif-files"
|
||
register: r
|
||
failed_when: >-
|
||
r.rc != 0 and
|
||
not (r.stderr | default('') | ldap_modify_noop)
|
||
|
||
- name: ➕ Add memberof overlay (cn=config via EXTERNAL)
|
||
ansible.builtin.shell: >-
|
||
container exec -i {{ lookup('container_address', 'svc-db-openldap', 'openldap') }}
|
||
ldapadd -Q -Y EXTERNAL -H {{ OPENLDAP_CONFIG_URI }}
|
||
-f "{{ [OPENLDAP_LDIF_PATH_DOCKER, 'configuration/02_member_of_configuration.ldif'] | path_join }}"
|
||
listen:
|
||
- "import-configuration-ldif-files"
|
||
register: r
|
||
failed_when: r.rc not in [0, 68]
|
||
|
||
- name: ➕ Add refint overlay (cn=config via EXTERNAL)
|
||
ansible.builtin.shell: >-
|
||
container exec -i {{ lookup('container_address', 'svc-db-openldap', 'openldap') }}
|
||
ldapadd -Q -Y EXTERNAL -H {{ OPENLDAP_CONFIG_URI }}
|
||
-f "{{ [OPENLDAP_LDIF_PATH_DOCKER, 'configuration/03_member_of_configuration.ldif'] | path_join }}"
|
||
listen:
|
||
- "import-configuration-ldif-files"
|
||
register: r
|
||
failed_when: r.rc not in [0, 68]
|
||
|
||
- name: 📥 Import users, groups, etc. to LDAP (data tree)
|
||
ansible.builtin.shell: >-
|
||
container exec -i {{ lookup('container_address', 'svc-db-openldap', 'openldap') }} ldapadd -x
|
||
-D "{{ OPENLDAP_BIND_DN }}"
|
||
-w "{{ OPENLDAP_BIND_PW }}"
|
||
-c
|
||
-f "{{ [OPENLDAP_LDIF_PATH_DOCKER, 'groups', (item | basename | regex_replace('\.j2$', ''))] | path_join }}"
|
||
listen:
|
||
- "import-groups-ldif-files"
|
||
register: ldapadd_result
|
||
changed_when: "'adding new entry' in ldapadd_result.stdout"
|
||
failed_when: ldapadd_result.rc not in [0, 20, 68, 65]
|
||
loop: "{{ query('fileglob', role_path ~ '/templates/ldif/groups/*.j2') | sort }}"
|
||
loop_control:
|
||
label: "{{ item | basename }}"
|