Run playbook starting of a certain task - Ansible.

Most of the time when people test Ansible playbook or debugging it, I see them run the whole of playbook every time! But one of my preferred ways to do that is "Start and Step".

These options allow you to run playbooks from a certain part not from the start, they are very useful for testing new plays or debugging!

With "--start-at-task" you can start a playbook at a particular task, as following it will start from that task called "xTASK" regardless its place in playbook.
ansible-playbook playbook.yml --start-at-task="xTASK"
Other option is "--step", which will ask you before each task, and you can choose if you want to run this task or not.
ansible-playbook playbook.yml --step
Perform task: xTASK? (y/n/c):
You can use both of two options in the same time, so it will start from certain task and ask you if you want to run it or not.

One more thing, however "start-at-task" is really handy, unfortunately it become less important in complex playbooks! Because if this task depends on another previous tasks it will fail or skipped! But as usual, it's better to know than not!
Powered by Blogger.

Hello, my name is Ahmed AbouZaid and this is my "lite" technical blog!

I'm a passionate DevOps, Linux system administrator, RedHat Certified Engineer (RHCE), AWS SysOps/Solutions Architect, Free/Open source geek, author, interested in environment, calligraphy, and I believe that “Details Matter”!

Automation, data, and metrics are my preferred areas. I have a built-in monitoring chip, and too lazy to do anything manually :D

Popular Posts