ansible-playbook(1)

โœจ ansible-playbook โ€” the main character of the ansible fam โœจ

okay so bestie, welcome to ansible-playbook(1), part of the system administration commands squad. This is the tool that runs Ansible playbooks โ€” and a playbook is basically a configuration + multinode deployment system, like a vibe board that actually executes. Want more deets? The project home page is right here: <https://docs.ansible.com>. iykyk ๐Ÿ’…


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

usage: ansible-playbook [-h] [--version] [-v] [--private-key
PRIVATE_KEY_FILE]
       [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT] [--ssh-common-args
       SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EXTRA_ARGS]
       [--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args
       SSH_EXTRA_ARGS] [-k | --connection-password-file
       CONNECTION_PASSWORD_FILE] [--force-handlers] [-b]
       [--become-method BECOME_METHOD] [--become-user BECOME_USER] [-K |
       --become-password-file BECOME_PASSWORD_FILE] [-t TAGS]
       [--skip-tags SKIP_TAGS] [-C] [-D] [-i INVENTORY] [--list-hosts]
       [-l SUBSET] [--flush-cache] [-e EXTRA_VARS] [--vault-id
       VAULT_IDS] [-J | --vault-password-file VAULT_PASSWORD_FILES] [-f
       FORKS] [-M MODULE_PATH] [--syntax-check] [--list-tasks]
       [--list-tags] [--step] [--start-at-task START_AT_TASK] playbook
       [playbook ...]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so this is the tool to run Ansible playbooks, which are a configuration and multinode deployment system. literally the whole point. for more info, the project home page is at <https://docs.ansible.com> โ€” go be nosy ๐Ÿฆ‹


๐ŸŽ€ COMMON OPTIONS ๐ŸŽ€

  • Playbook(s) โ€” the playbook file(s) you're feeding it, bestie. that's the whole assignment ๐Ÿซถ
  • --become-method 'BECOME_METHOD' โ€” which privilege escalation method to use (default=sudo). wanna see the valid choices? run ansible-doc -t become -l and it'll show you the menu โœจ
  • --become-password-file 'BECOME_PASSWORD_FILE', --become-pass-file 'BECOME_PASSWORD_FILE' โ€” become password file ๐Ÿ”
  • --become-user 'BECOME_USER' โ€” run operations as this user (default=root) ๐Ÿ‘‘
  • --connection-password-file 'CONNECTION_PASSWORD_FILE', --conn-pass-file 'CONNECTION_PASSWORD_FILE' โ€” connection password file ๐Ÿ”‘
  • --flush-cache โ€” clear the fact cache for every host in inventory ๐Ÿงน
  • --force-handlers โ€” run handlers even if a task fails. no skipping, periodt ๐Ÿ’…
  • --list-hosts โ€” outputs a list of matching hosts; does not execute anything else. just a lil peek ๐Ÿ‘€
  • --list-tags โ€” list all available tags ๐Ÿท๏ธ
  • --list-tasks โ€” list all tasks that would be executed ๐Ÿ“‹
  • --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE' โ€” use this file to authenticate the connection ๐Ÿ—๏ธ
  • --scp-extra-args 'SCP_EXTRA_ARGS' โ€” specify extra arguments to pass to scp only (e.g. -l) ๐Ÿ“ฆ
  • --sftp-extra-args 'SFTP_EXTRA_ARGS' โ€” specify extra arguments to pass to sftp only (e.g. -f, -l) ๐Ÿ“
  • --skip-tags โ€” only run plays and tasks whose tags do not match these values. this argument may be specified multiple times ๐Ÿ™…โ€โ™€๏ธ
  • --ssh-common-args 'SSH_COMMON_ARGS' โ€” specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand) ๐ŸŒ
  • --ssh-extra-args 'SSH_EXTRA_ARGS' โ€” specify extra arguments to pass to ssh only (e.g. -R) ๐Ÿ›ฐ๏ธ
  • --start-at-task 'START_AT_TASK' โ€” start the playbook at the task matching this name โฉ
  • --step โ€” one-step-at-a-time: confirm each task before running. very "are you sure bestie" energy ๐Ÿ™ˆ
  • --syntax-check โ€” perform a syntax check on the playbook, but do not execute it. read-only queen ๐Ÿ‘‘
  • --vault-id โ€” the vault identity to use. this argument may be specified multiple times ๐Ÿ”ฎ
  • --vault-password-file, --vault-pass-file โ€” vault password file ๐Ÿคซ
  • --version โ€” show program's version number, config file location, configured module search path, module location, executable location and exit. the full rรฉsumรฉ, then bounce ๐Ÿ’จ
  • -C, --check โ€” don't make any changes; instead, try to predict some of the changes that may occur ๐Ÿ”
  • -D, --diff โ€” when changing (small) files and templates, show the differences in those files; works great with --check. the before/after glow-up reveal โœจ
  • -J, --ask-vault-password, --ask-vault-pass โ€” ask for vault password ๐Ÿ™‹โ€โ™€๏ธ
  • -K, --ask-become-pass โ€” ask for privilege escalation password ๐Ÿ”
  • -M, --module-path โ€” prepend colon-separated path(s) to module library (default={{ ANSIBLE_HOME ~ "/plugins/modules:/usr/share/ansible/plugins/modules" }}). this argument may be specified multiple times ๐Ÿ—‚๏ธ
  • -T 'TIMEOUT', --timeout 'TIMEOUT' โ€” override the connection timeout in seconds (default depends on connection) โฑ๏ธ
  • -b, --become โ€” run operations with become (does not imply password prompting) ๐Ÿ’ช
  • -c 'CONNECTION', --connection 'CONNECTION' โ€” connection type to use (default=ssh) ๐Ÿ”Œ
  • -e, --extra-vars โ€” set additional variables as key=value or YAML/JSON, if filename prepend with @. this argument may be specified multiple times ๐Ÿ“
  • -f 'FORKS', --forks 'FORKS' โ€” specify number of parallel processes to use (default=5) ๐Ÿด
  • -h, --help โ€” show this help message and exit ๐Ÿ†˜
  • -i, --inventory, --inventory-file โ€” specify inventory host path or comma separated host list. this argument may be specified multiple times ๐Ÿ“š
  • -k, --ask-pass โ€” ask for connection password ๐Ÿ™Š
  • -l 'SUBSET', --limit 'SUBSET' โ€” further limit selected hosts to an additional pattern ๐ŸŽฏ
  • -t, --tags โ€” only run plays and tasks tagged with these values. this argument may be specified multiple times ๐Ÿท๏ธ
  • -u 'REMOTE_USER', --user 'REMOTE_USER' โ€” connect as this user (default=None) ๐Ÿ‘ค
  • -v, --verbose โ€” causes Ansible to print more debug messages. adding multiple -v will increase the verbosity, the builtin plugins currently evaluate up to -vvvvvv. a reasonable level to start is -vvv, connection debugging might require -vvvv. this argument may be specified multiple times ๐Ÿ—ฃ๏ธ

๐Ÿฆ‹ INVENTORY ๐Ÿฆ‹

Ansible stores the hosts it can potentially operate on in an inventory. this can be a YAML file, ini-like file, a script, directory, list, etc. โ€” honestly whatever shape your chaos takes. for additional options, see the documentation on <https://docs.ansible.com/> ๐Ÿ“–


๐ŸŒธ ENVIRONMENT ๐ŸŒธ

the following environment variables may be specified:

  • ANSIBLE_INVENTORY โ€” override the default ansible inventory sources
  • ANSIBLE_LIBRARY โ€” override the default ansible module library path
  • ANSIBLE_CONFIG โ€” specify override location for the ansible config file

many more are available for most options in ansible.cfg ๐Ÿ’ซ

for a full list check <https://docs.ansible.com/>. or use the ansible-config command ๐Ÿ‘‘


๐ŸŽ€ FILES ๐ŸŽ€

  • /etc/ansible/hosts โ€” default inventory file
  • /etc/ansible/ansible.cfg โ€” config file, used if present
  • ~/.ansible.cfg โ€” user config file, overrides the default config if present
  • ./ansible.cfg โ€” local config file (in current working directory) assumed to be 'project specific' and overrides the rest if present.

as mentioned above, the ANSIBLE_CONFIG environment variable will override all others. it's giving final boss energy ๐Ÿ‘‘๐Ÿ”ฅ


๐Ÿ’œ AUTHOR ๐Ÿ’œ

Ansible was originally written by Michael DeHaan. legend behaviour, fr fr ๐Ÿซถ


Copyright ยฉ 2018 Red Hat, Inc | Ansible. Ansible is released under the terms of the GPLv3 license ๐Ÿ“œ


โญ SEE ALSO โญ

  • ansible (1)
  • ansible-config (1)
  • ansible-console (1)
  • ansible-doc (1)
  • ansible-galaxy (1)
  • ansible-inventory (1)
  • ansible-pull (1)
  • ansible-vault (1)

extensive documentation is available in the documentation site: <<https://docs.ansible.com>>. IRC and mailing list info can be found in file CONTRIBUTING.md, available in: <<https://github.com/ansible/ansible>> ๐Ÿ’Œ


and that's the whole page bestie ๐Ÿ’… this icon was brought to you by Ansible 2.22.0, living under the name ansible-playbook(1) โ€” go run some playbooks, slay, and remember: check mode first ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: ansible-core 2.22.0-1 ยท GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms