I am executing play-book on only one host.
My Current task execution flow is:
1) Executing task
2) If any of the task fails in between, clean up everything
3) Rerun from the beginning.
This does not sound very efficient. I want to create flow very much like this,
1) Executing task
2) Task failed ..
3) if we rerun the play-book, ansible should execute tasks from the failed task. It should not rerun from the beginning.
In attempt to do that I was trying to achieve that once task was failed, I was trying to execute play-book with "--limit", it throws following error.
root@centos:/etc/ansible# ansible-playbook stack.yml --limit -vvvv
ERROR: provided hosts list is empty
root@centos:/etc/ansible# cat /root/stack.retry
10.17.10.150
I am not sure is this the right way to rerun the play-book to achieve this work flow.
Use the option --start-at-task=START_AT
This will start your playbook at the task matching the given name. In your case:
ansible-playbook stack.yml --start-at-task=START_AT
change "START_AT" with the name of the task you will start at.
The --limit option you have used is to limit the playbook to hosts matching the pattern and not limiting tasks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With