Brian Coca 2 weeks ago committed by GitHub
commit 521964df35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,32 @@
- name: Test handler
hosts: testhost, testhost2
strategy: free
vars:
timeout:
testhost: 5
testhost2: 70
tasks:
- name: "Step #1"
shell: "sleep {{ timeout[inventory_hostname] }}"
notify: stage1
- name: "Step #2"
shell: "sleep {{ 5 | random }}"
handlers:
- name: "Stage 1 - Step #1"
shell: "sleep {{ item }}"
listen: stage1
with_items:
- "{{ 5 | random }}"
- "{{ 5 | random }}"
- name: "Stage 1 - Step #2"
shell: "sleep {{ 5 | random }}"
listen: stage1
notify: stage2
- name: "Stage 2"
debug:
msg: "{{ inventory_hostname }} second stage"
listen: stage2

@ -66,6 +66,10 @@ done
[ "$(ansible-playbook test_handlers_include_role.yml -i ../../inventory -v "$@" \
| grep -E -o 'RUNNING HANDLER \[test_handlers_include_role : .*]')" = "RUNNING HANDLER [test_handlers_include_role : test handler]" ]
# ensures handlers fire equally for both hosts on free strategy
[ "$(ansible-playbook free_strategy.yml -i ../../inventory -v "$@" | grep testhost| grep -c -v testhost2)" = "9" ]
[ "$(ansible-playbook free_strategy.yml -i ../../inventory -v "$@" | grep -c testhost2)" = "9" ]
# Notify handler listen
ansible-playbook test_handlers_listen.yml -i inventory.handlers -v "$@"

Loading…
Cancel
Save