So I have been playing around with multiple callbacks and ordering. I
created two callback plugins: calltest1, calltest2. Each one simply prints
its number and fcn to the screen:
e.g.
TEST1: v2_playbook_on_start()
TEST2: v2_playbook_on_start()
Some observations:
1. If I put the callbacks in ./callback_plugins, I cannot choose the order
at runtime. I assume they run in ABC order.
2. If I put the callbacks in separate roles, (
roles/calltest1/callback_plugins, roles/calltest2/callback_plugins/
respectively), then I can control the ordering by calling roles:
file: calltestsite.yml
---
roles:
- calltest2
- calltest1
output:
TEST2: v2_playbook_on_start()
TEST1: v2_playbook_on_start()
3. However, and this is where it gets weird:
If I set calltest2 as a dependency of calltest1, calltest1 fires first!
file: roles/calltest1/meta/main.yml
---
dependencies:
- { role: calltest2 }
file: calltestsite.yml
---
roles:
- calltest1
output:
TEST1: v2_playbook_on_start()
TEST2: v2_playbook_on_start()
4. what's really weird is that I know for sure that calltest2 is actually
running first:
file: roles/calltest1/tasks/main.yml
---
- name: calltest1 show me role task
debug: var="calltest1 role task"
file: roles/calltest1/tasks/main.yml
---
- name: calltest1 show me role task
debug: var="calltest1 role task"
output:
TASK [calltest2 : calltest2 show me role task]
*********************************
TEST1: v2_runner_on_ok()
TEST2: v2_runner_on_ok()
TEST1: v2_playbook_on_task_start()
TEST2: v2_playbook_on_task_start()
TASK [calltest1 : calltest1 show me role task]
*********************************
TEST1: v2_runner_on_ok()
TEST2: v2_runner_on_ok()
Is this expected behavior?
(fwiw, I'm not planning on listing callback dependencies, but thought the
behavior was curious)
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7649fa06-4e4a-44f8-a1c6-cf5f33dd618d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.