2017-01-27 09:39:22 +00:00
|
|
|
# ansible-playbook
|
|
|
|
|
|
|
|
> Execute tasks defined in playbook on remote machines over SSH.
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html>.
|
2017-01-27 09:39:22 +00:00
|
|
|
|
|
|
|
- Run tasks in playbook:
|
|
|
|
|
|
|
|
`ansible-playbook {{playbook}}`
|
|
|
|
|
2024-02-09 14:34:08 +00:00
|
|
|
- Run tasks in playbook with custom host [i]nventory:
|
2017-01-27 09:39:22 +00:00
|
|
|
|
|
|
|
`ansible-playbook {{playbook}} -i {{inventory_file}}`
|
2017-10-26 21:07:08 +01:00
|
|
|
|
2024-02-09 14:34:08 +00:00
|
|
|
- Run tasks in playbook with [e]xtra variables defined via the command-line:
|
2017-10-26 21:07:08 +01:00
|
|
|
|
|
|
|
`ansible-playbook {{playbook}} -e "{{variable1}}={{value1}} {{variable2}}={{value2}}"`
|
|
|
|
|
2024-02-09 14:34:08 +00:00
|
|
|
- Run tasks in playbook with [e]xtra variables defined in a JSON file:
|
2017-10-26 21:07:08 +01:00
|
|
|
|
|
|
|
`ansible-playbook {{playbook}} -e "@{{variables.json}}"`
|
2020-07-17 17:58:11 +01:00
|
|
|
|
|
|
|
- Run tasks in playbook for the given tags:
|
|
|
|
|
2020-09-11 04:55:18 +01:00
|
|
|
`ansible-playbook {{playbook}} --tags {{tag1,tag2}}`
|
2020-07-17 17:58:11 +01:00
|
|
|
|
|
|
|
- Run tasks in a playbook starting at a specific task:
|
|
|
|
|
|
|
|
`ansible-playbook {{playbook}} --start-at {{task_name}}`
|
2024-06-05 11:18:21 +01:00
|
|
|
|
|
|
|
- Run tasks in a playbook without making any changes (dry-run):
|
|
|
|
|
|
|
|
`ansible-playbook {{playbook}} --check --diff`
|