ansible(1)
ansible(1) π β¨
okay bestie, listen β this is ansible(1), the main character of the Ansible cinematic universe, from the System administration commands family, and I'm gonna walk you through the whole thing. no gatekeeping, no cap. π«Ά
β¨ Name β¨
ansible β define and run a single task 'playbook' against a set of hosts. that's it, that's the vibe. one task, a whole bunch of hosts. slay. π
πΈ SYNOPSIS πΈ
usage: ansible [-h] [--version] [-v] [-b] [--become-method
BECOME_METHOD]
[--become-user BECOME_USER] [-K | --become-password-file
BECOME_PASSWORD_FILE] [-i INVENTORY] [--list-hosts] [-l SUBSET]
[--flush-cache] [-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE]
[--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] [-C] [-D]
[-e EXTRA_VARS] [--vault-id VAULT_IDS] [-J |
--vault-password-file VAULT_PASSWORD_FILES] [-f FORKS] [-M
MODULE_PATH] [--playbook-dir BASEDIR] [--task-timeout
TASK_TIMEOUT] [-a MODULE_ARGS] [-m MODULE_NAME] pattern
like yes it's a lot of brackets but that's just how it eats. π
π¦ DESCRIPTION π¦
so basically: ansible is an extra-simple tool/framework/API for doing 'remote things'. lowercase, iconic, humble-ish. and this specific command lets you define and run a single task 'playbook' against a set of hosts β one task, live, right there in your terminal. it's giving main character energy, honestly. π
π COMMON OPTIONS π
okay this is the long part, but you got this. every single one, in order, no skipping. β¨
- host pattern β your host pattern. the thing you're pointing at. π―
--become-method 'BECOME_METHOD'β the privilege escalation method to use (default=sudo). runansible-doc -t become -lto list all the valid choices, iykyk.--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. yeet the cached facts. π§Ή--list-hostsβ outputs a list of matching hosts; does not execute anything else. it's literally just "who would be affected", that's all. π--playbook-dir 'BASEDIR'β since this tool does not use playbooks, use this as a substitute playbook directory. this sets the relative path for many features includingroles/group_vars/etc. fake playbook dir, real functionality. π--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 toscponly (e.g.-l).--sftp-extra-args 'SFTP_EXTRA_ARGS'β specify extra arguments to pass tosftponly (e.g.-f,-l).--ssh-common-args 'SSH_COMMON_ARGS'β specify common arguments to pass tosftp/scp/ssh(e.g.ProxyCommand).--ssh-extra-args 'SSH_EXTRA_ARGS'β specify extra arguments to pass tosshonly (e.g.-R).--task-timeout 'TASK_TIMEOUT'β set the task timeout limit in seconds, must be a positive integer. no zero, no negatives, no vibes-based numbers. β°--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 the program's version number, config file location, configured module search path, module location, executable location, and exit. a whole info dump, honestly kind of a flex. π-B 'SECONDS',--background 'SECONDS'β run asynchronously, failing after X seconds (default=N/A).-C,--checkβ don't make any changes; instead, try to predict some of the changes that may occur. window shopping for infra. ποΈ-D,--diffβ when changing (small) files and templates, show the differences in those files; works great with--check.-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.-P 'POLL_INTERVAL',--poll 'POLL_INTERVAL'β set the poll interval if using-B(default=15).-T 'TIMEOUT',--timeout 'TIMEOUT'β override the connection timeout in seconds (default depends on connection).-a 'MODULE_ARGS',--args 'MODULE_ARGS'β the action's options in space separatedk=vformat:-a 'opt1=val1 opt2=val2'or a json string:-a '{"opt1": "val1", "opt2": "val2"}'.-b,--becomeβ run operations with become (does not imply password prompting). important clarification bestie, it does NOT prompt you for anything. π-c 'CONNECTION',--connection 'CONNECTION'β connection type to use (default=ssh).-e,--extra-varsβ set additional variables askey=valueor 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). five little worker bees by default. π-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. narrowing the guest list. π-m 'MODULE_NAME',--module-name 'MODULE_NAME'β name of the action to execute (default=command).-o,--one-lineβ condense output. one line. that's the whole thing.-t 'TREE',--tree 'TREE'β log output to this directory.-u 'REMOTE_USER',--user 'REMOTE_USER'β connect as this user (default=None).-v,--verboseβ causes Ansible to print more debug messages. adding multiple-vwill 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, an ini-like file, a script, a directory, a list, etc. β like, it's flexible, it's fluid. 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 sourcesANSIBLE_LIBRARYβ override the default ansible module library pathANSIBLE_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
and as mentioned above, the ANSIBLE_CONFIG environment variable will override all others. it's the final boss of config precedence. π
π AUTHOR π
Ansible was originally written by Michael DeHaan. legend behavior, fr fr. π«Ά
π COPYRIGHT π
Copyright Β© 2018 Red Hat, Inc | Ansible. Ansible is released under the terms of the GPLv3 license.
β SEE ALSO β
ansible-config (1), ansible-console (1), ansible-doc (1), ansible-galaxy (1), ansible-inventory (1), ansible-playbook (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>> πΈ
okay that's the whole page, you absolute scholar. this one's brought to you by Ansible 2.22.0 β that's the version, bestie, and yes, she's iconic. mwah, go run some tasks. π β¨π
π¦ 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