Forrest logo
back to the ansible-playbook tool

ansible-playbook:tldr:5f73b

ansible-playbook: Run tasks in playbook for the given tags.
$ ansible-playbook ${playbook} --tags ${tag1,tag2}
try on your machine

This is a command using the Ansible automation tool to execute a playbook with specific tags.

  • ansible-playbook is the command to run Ansible playbooks.
  • ${playbook} is a variable that should be replaced with the name or path of the playbook file you want to execute.
  • --tags is an option used to specify which tasks or roles within the playbook to execute. It is followed by ${tag1,tag2}, which represents a comma-separated list of tags. These tags are used to identify specific tasks or roles defined in the playbook.

For example, if you have a playbook named myplaybook.yml and it contains multiple tasks assigned with different tags such as install, configure, and restart, and you only want to execute tasks with the tags install and configure, you would run the command:

ansible-playbook myplaybook.yml --tags install,configure

This would only execute tasks in the playbook that have been assigned the tags install and configure, while skipping the tasks with the restart tag.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ansible-playbook tool