14/11/2015

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, I'm a passionate Tech Lead DevOps Engineer. 👋

I specialize in Cloud-Native and Kubernetes. I'm also a Free/Open source geek and book author. My favorite topics are DevOps transformation, DevSecOps, automation, data, and metrics.

More about me ➡️

Contact Me

Name

Email *

Message *

Start Your DevOps Engineer Journey!

Start Your DevOps Engineer Journey!
Start your DevOps career for free the Agile way in 2024 with the Dynamic DevOps Roadmap ⭐

Latest Post

Bootstrap Cloud-Native bootstrappers like Crossplane with K3d - Automation

I created a logo for the Crossplane Bootstrapper because all good projects deserve a logo. 😁 TL;DR ...

Popular Posts

Blog Archive