Forrest logo
back to the ansible-playbook tool

ansible-playbook:tldr:754ae

ansible-playbook: Run tasks in playbook with extra variables defined via the command-line.
$ ansible-playbook ${playbook} -e "${variable1}=${value1} ${variable2}=${value2}"
try on your machine

This command is an example of using the Ansible command line tool, ansible-playbook, to execute a playbook with some extra variables specified as command-line arguments.

  • ansible-playbook: This is the Ansible command line tool used to run playbooks which are the configuration files used to define and manage infrastructure on remote systems.

  • ${playbook}: This placeholder should be replaced with the path or filename of the playbook to be executed. It indicates the playbook file that contains the tasks and instructions for configuring the target systems.

  • -e: This option is used to pass extra variables to the playbook. It allows you to define additional variables that can be used in the playbook tasks or templates.

  • "${variable1}=${value1}": This sets the value of the variable named "variable1" to "value1". The syntax "${variable1}" allows you to reference the value of that variable wherever it is needed in the playbook.

  • "${variable2}=${value2}": Similarly, this sets the value of the variable named "variable2" to "value2".

In summary, this command executes an Ansible playbook and passes two extra variables, "variable1" and "variable2", with their corresponding values "value1" and "value2", respectively, to the playbook for use in task execution.

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