I have a huge playbook that calls multiple playbooks within it. It looks something like this:
cat global_playbook.yml
---
- hosts: server150
tasks:
- include_tasks: folder/playbook1.yml
vars:
...
- include_tasks: folder/playbook2.yml # I'm trying to start from here.
vars:
...
tags: test
- include_tasks: folder/playbook3.yml
vars:
...
... and so on
Sometimes, when I run it, it fails. And I can't seem to get it to start from a specific position.
I'm trying to start from folder/playbook2.yml
. I tried doing:
ansible-playbook global_playbook.yml -start-at-task="folder/playbook2.yml"
ansible-playbook global_playbook.yml -start-at-task="**task within playbook2**"
ansible-playbook global_playbook.yml --tags="test"
But none of the work.
- I can't run the playbook directly because as seen in the example at the beginning of this thread, the variables are in the global playbook. It wouldn't work when I had the variables in each playbook. They also don't have a hosts defined.
- I know I can use
--step
so it would ask me which task to run but it just runs too many playbooks for that. Not to mention, since I'm usinginclude_tasks
, it won't tell me what the task only after I agree to it!
When using a playbook that calls other playbooks, is it possible to have it start from a specific point? Or have it continue from where it failed?
Thanks ahead!