mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	cleanup: remove unused handlers and add integration test for unused handlers
Removed obsolete handlers from roles (VirtualBox, backup-to-USB, OpenLDAP) and introduced an integration test under tests/integration/test_handlers_invoked.py that ensures all handlers defined in roles/*/handlers are actually notified somewhere in the code base. This keeps the repository clean by preventing unused or forgotten handlers from accumulating. Ref: https://chatgpt.com/share/68b6b28e-4388-800f-87d2-34dfb34b8d36
This commit is contained in:
		| @@ -1,4 +0,0 @@ | ||||
| --- | ||||
| - name: reload virtualbox kernel modules | ||||
|   become: true | ||||
|   command: vboxreload | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| - name: "reload svc-bkp-loc-2-usb service" | ||||
|   systemd: | ||||
|     name: "{{ 'svc-bkp-loc-2-usb' | get_service_name(SOFTWARE_NAME) }}" | ||||
|     state: reloaded | ||||
|     daemon_reload: yes | ||||
| @@ -1,55 +0,0 @@ | ||||
| - name: Load memberof module from file in OpenLDAP container | ||||
|   shell: > | ||||
|     docker exec -i {{ openldap_name }} ldapmodify -Y EXTERNAL -H ldapi:/// -f {{ openldap_ldif_docker_path }}configuration/01_member_of_configuration.ldif | ||||
|   listen:  | ||||
|     - "Import configuration LDIF files" | ||||
|     - "Import all LDIF files" | ||||
|   # @todo Remove the following ignore errors when setting up a new server | ||||
|   # Just here because debugging would take to much time | ||||
|   ignore_errors: true | ||||
|  | ||||
| - name: Refint Module Activation for OpenLDAP | ||||
|   shell: > | ||||
|     docker exec -i {{ openldap_name }} ldapadd -Y EXTERNAL -H ldapi:/// -f {{ openldap_ldif_docker_path }}configuration/02_member_of_configuration.ldif | ||||
|   listen:  | ||||
|     - "Import configuration LDIF files" | ||||
|     - "Import all LDIF files" | ||||
|   register: ldapadd_result | ||||
|   failed_when: ldapadd_result.rc not in [0, 68] | ||||
|   # @todo Remove the following ignore errors when setting up a new server | ||||
|   # Just here because debugging would take to much time | ||||
|   ignore_errors: true | ||||
|  | ||||
| - name: "Import schemas" | ||||
|   shell: > | ||||
|     docker exec -i {{ openldap_name }} ldapadd -Y EXTERNAL -H ldapi:/// -f "{{ openldap_ldif_docker_path }}schema/{{ item | basename | regex_replace('\.j2$', '') }}" | ||||
|   register: ldapadd_result | ||||
|   changed_when: "'adding new entry' in ldapadd_result.stdout" | ||||
|   failed_when: ldapadd_result.rc not in [0, 80] | ||||
|   listen: | ||||
|     - "Import schema LDIF files" | ||||
|     - "Import all LDIF files" | ||||
|   loop: "{{ lookup('fileglob', role_path ~ '/templates/ldif/schema/*.j2', wantlist=True) }}" | ||||
|  | ||||
| - name: Refint Overlay Configuration for OpenLDAP | ||||
|   shell: > | ||||
|     docker exec -i {{ openldap_name }} ldapmodify -Y EXTERNAL -H ldapi:/// -f {{ openldap_ldif_docker_path }}configuration/03_member_of_configuration.ldif | ||||
|   listen: | ||||
|     - "Import configuration LDIF files" | ||||
|     - "Import all LDIF files" | ||||
|   register: ldapadd_result | ||||
|   failed_when: ldapadd_result.rc not in [0, 68] | ||||
|   # @todo Remove the following ignore errors when setting up a new server | ||||
|   # Just here because debugging would take to much time | ||||
|   ignore_errors: true | ||||
|  | ||||
| - name: "Import users, groups, etc. to LDAP" | ||||
|   shell: > | ||||
|     docker exec -i {{ openldap_name }} ldapadd -x -D "{{LDAP.DN.ADMINISTRATOR.DATA}}" -w "{{ LDAP.BIND_CREDENTIAL }}" -c -f "{{ openldap_ldif_docker_path }}groups/{{ item | basename | regex_replace('\.j2$', '') }}" | ||||
|   register: ldapadd_result | ||||
|   changed_when: "'adding new entry' in ldapadd_result.stdout" | ||||
|   failed_when: ldapadd_result.rc not in [0, 20, 68, 65] | ||||
|   listen: | ||||
|     - "Import groups LDIF files" | ||||
|     - "Import all LDIF files" | ||||
|   loop: "{{ query('fileglob', role_path ~ '/templates/ldif/groups/*.j2') | sort }}" | ||||
		Reference in New Issue
	
	Block a user