
上QQ阅读APP看书,第一时间看更新
How it works...
We can use tags to mark both tasks and plays with a given tag in order to use it to control which tasks or plays get executed. This gives us more control when developing playbooks to allow us to run the same playbook. However, with each run, we can control what we are deploying. In the example playbook in this recipe, we have tagged the tasks as OSPF, BGP, or NTP and have applied the routing tag to both the OSPF and BGP tasks. This allows us to selectively run the tasks within our playbook as shown here:
- With no tags specified, this will run all the tasks in the playbook with no change in the behavior, as shown in the following screenshot:
- Using the ospf tag, we will only run any task marked with this tag, as shown here:
- Using the routing tag, we will run all tasks marked with this tag, as shown here: