chore(ansible): force notify handlers

This commit is contained in:
Michele Cereda
2026-02-08 15:48:16 +01:00
parent 01c24d1340
commit 77e404b90d
2 changed files with 20 additions and 3 deletions

View File

@@ -1,7 +1,11 @@
--- ---
- name: Do nothing - name: Do nothing
tags: noop # this really does nothing; it also *cannot* be considered 'changed', 'failed', or 'skipped'
tags:
- do nothing
- noop
- pass
ansible.builtin.meta: noop ansible.builtin.meta: noop
- name: Execute long-running tasks - name: Execute long-running tasks
@@ -49,7 +53,20 @@
fail_msg: What to say if any of the above conditions fail fail_msg: What to say if any of the above conditions fail
success_msg: What to say if all of the above conditions succeed success_msg: What to say if all of the above conditions succeed
- name: Force execution of *notified* handlers - name: Notify handlers
tags: notify_handlers
delegate_to: localhost
connection: local
ansible.builtin.command: 'true'
changed_when:
# the 'command' module currently always registers as 'changed'
# this is only here to ensure the task notifies the handlers in the event "command"'s behaviour changes in time
true
notify:
- some handler
- some other handler
- name: Force execution of handlers that have been *notified* up to now
tags: force_handlers tags: force_handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers

View File

@@ -4,7 +4,7 @@
# No groups # No groups
- name: Forcefully run on the controller - name: Forcefully run on the controller
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1 # or 'localhost'
connection: local connection: local
changed_when: false changed_when: false
ansible.builtin.command: hostname ansible.builtin.command: hostname