Complete Ansible commands reference — 130 commands across 4 categories. Quick reference cheat sheet for Linux & Mac.
| Shortcut | Action |
|---|---|
| ansible --become-method <BECOME_METHOD> | Privilege escalation method to use (default=sudo) |
| ansible --become-password-file <BECOME_PASSWORD_FILE> | Become password file |
| ansible --become-user <BECOME_USER> | Run operations as this user |
| ansible --flush-cache | Clear the fact cache for every host in inventory |
| ansible --list-hosts | Outputs a list of matching hosts |
| ansible --playbook-dir <BASEDIR> | Since this tool does not use playbooks |
| ansible --private-key <PRIVATE_KEY_FILE> | Use this file to authenticate the connection |
| ansible --scp-extra-args <SCP_EXTRA_ARGS> | Specify extra arguments to pass to scp only (e.g |
| ansible --sftp-extra-args <SFTP_EXTRA_ARGS> | Specify extra arguments to pass to sftp only (e.g |
| ansible --ssh-common-args <SSH_COMMON_ARGS> | Specify common arguments to pass to sftp/scp/ssh |
| ansible --ssh-extra-args <SSH_EXTRA_ARGS> | Specify extra arguments to pass to ssh only (e.g |
| ansible --task-timeout <TASK_TIMEOUT> | Set task timeout limit in seconds, must be positive |
| ansible --vault-id | The vault identity to use |
| ansible --vault-password-file | Vault password file |
| ansible --version | Show program's version number, config file |
| ansible -B <SECONDS> | Run asynchronously, failing after X seconds |
| ansible -C | Don't make any changes |
| ansible -D | When changing (small) files and templates, show |
| ansible -J | Ask for vault password |
| ansible -K | Ask for privilege escalation password |
| ansible -M | Prepend colon-separated path(s) to module library |
| ansible -P <POLL_INTERVAL> | Set the poll interval if using -B |
| ansible -T <TIMEOUT> | Override the connection timeout in seconds |
| ansible -a <MODULE_ARGS> | The action's options in space separated k=v format |
| ansible -b | Run operations with become (does not imply password |
| ansible -c <CONNECTION> | Connection type to use |
| ansible -e | Set additional variables as key=value or YAML/JSON |
| ansible -f <FORKS> | Specify number of parallel processes to use |
| ansible -h | Show this help message and exit |
| ansible -i | Specify inventory host path or comma separated host |
| ansible -k | Ask for connection password |
| ansible -l <SUBSET> | Further limit selected hosts to an additional |
| ansible -m <MODULE_NAME> | Name of the action to execute |
| ansible -o | Condense output |
| ansible -t <TREE> | Log output to this directory |
| ansible -u <REMOTE_USER> | Connect as this user |
| ansible -v | Causes Ansible to print more debug messages |
| Shortcut | Action |
|---|---|
| ansible-playbook --become-method <BECOME_METHOD> | Privilege escalation method to use (default=sudo) |
| ansible-playbook --become-user <BECOME_USER> | Run operations as this user |
| ansible-playbook --flush-cache | Clear the fact cache for every host in inventory |
| ansible-playbook --force-handlers | Run handlers even if a task fails |
| ansible-playbook --list-hosts | Outputs a list of matching hosts |
| ansible-playbook --list-tags | List all available tags |
| ansible-playbook --list-tasks | List all tasks that would be executed |
| ansible-playbook --private-key <PRIVATE_KEY_FILE> | Use this file to authenticate the connection |
| ansible-playbook --scp-extra-args <SCP_EXTRA_ARGS> | Specify extra arguments to pass to scp only (e.g |
| ansible-playbook --sftp-extra-args <SFTP_EXTRA_ARGS> | Specify extra arguments to pass to sftp only (e.g |
| ansible-playbook --skip-tags | Only run plays and tasks whose tags do not match |
| ansible-playbook --ssh-common-args <SSH_COMMON_ARGS> | Specify common arguments to pass to sftp/scp/ssh |
| ansible-playbook --ssh-extra-args <SSH_EXTRA_ARGS> | Specify extra arguments to pass to ssh only (e.g |
| ansible-playbook --start-at-task <START_AT_TASK> | Start the playbook at the task matching this name |
| ansible-playbook --step | One-step-at-a-time: confirm each task before running |
| ansible-playbook --syntax-check | Perform a syntax check on the playbook, but do not |
| ansible-playbook --vault-id | The vault identity to use |
| ansible-playbook --vault-password-file | Vault password file |
| ansible-playbook --version | Show program's version number, config file |
| ansible-playbook -C | Don't make any changes |
| ansible-playbook -D | When changing (small) files and templates, show |
| ansible-playbook -J | Ask for vault password |
| ansible-playbook -K | Ask for privilege escalation password |
| ansible-playbook -M | Prepend colon-separated path(s) to module library |
| ansible-playbook -T <TIMEOUT> | Override the connection timeout in seconds |
| ansible-playbook -b | Run operations with become (does not imply password |
| ansible-playbook -c <CONNECTION> | Connection type to use |
| ansible-playbook -e | Set additional variables as key=value or YAML/JSON |
| ansible-playbook -f <FORKS> | Specify number of parallel processes to use |
| ansible-playbook -h | Show this help message and exit |
| ansible-playbook -i | Specify inventory host path or comma separated host |
| ansible-playbook -k | Ask for connection password |
| ansible-playbook -l <SUBSET> | Further limit selected hosts to an additional |
| ansible-playbook -t | Only run plays and tasks tagged with these values |
| ansible-playbook -u <REMOTE_USER> | Connect as this user |
| ansible-playbook -v | Causes Ansible to print more debug messages |
| Shortcut | Action |
|---|---|
| ansible-vault --version | Show program's version number, config file |
| ansible-vault -h | Show this help message and exit |
| ansible-vault -v | Causes Ansible to print more debug messages |
| ansible-vault --encrypt-vault-id <ENCRYPT_VAULT_ID> | The vault id used to encrypt (required if more than |
| ansible-vault --skip-tty-check | Allows editor to be opened when no tty attached |
| ansible-vault --vault-id | The vault identity to use |
| ansible-vault --vault-password-file | Vault password file |
| ansible-vault -J | Ask for vault password |
| ansible-vault --output <OUTPUT_FILE> | Output file name for encrypt or decrypt |
| ansible-vault --show-input | Do not hide input when prompted for the string |
| ansible-vault --stdin-name <ENCRYPT_STRING_STDIN_NAME> | Specify the variable name for stdin |
| ansible-vault -n | Specify the variable name |
| ansible-vault -p | Prompt for the string to encrypt |
| ansible-vault --new-vault-id <NEW_VAULT_ID> | The new vault identity to use for rekey |
| Shortcut | Action |
|---|---|
| ansible-galaxy --version | Show program's version number, config file |
| ansible-galaxy -h | Show this help message and exit |
| ansible-galaxy -v | Causes Ansible to print more debug messages |
| ansible-galaxy --clear-response-cache | Clear the existing server response cache |
| ansible-galaxy --no-cache | Do not use the server response cache |
| ansible-galaxy --pre | Include pre-release versions |
| ansible-galaxy --timeout <TIMEOUT> | The time to wait for operations against the galaxy |
| ansible-galaxy --token <API_KEY> | The Ansible Galaxy API key which can be found |
| ansible-galaxy -c | Ignore SSL certificate validation errors |
| ansible-galaxy -n | Don't download collection(s) listed as dependencies |
| ansible-galaxy -p <DOWNLOAD_PATH> | The directory to download the collections |
| ansible-galaxy -r <REQUIREMENTS> | A file containing a list of collections |
| ansible-galaxy -s <API_SERVER> | The Galaxy API server URL |
| ansible-galaxy --collection-skeleton <COLLECTION_SKELETON> | The path to a collection skeleton that the new |
| ansible-galaxy --init-path <INIT_PATH> | The path in which the skeleton collection |
| ansible-galaxy -e | Set additional variables as key=value or YAML/JSON |
| ansible-galaxy -f | Force overwriting an existing role or collection |
| ansible-galaxy --output-path <OUTPUT_PATH> | The path in which the collection is built |
| ansible-galaxy --import-timeout <IMPORT_TIMEOUT> | The time to wait for the collection import process |
| ansible-galaxy --no-wait | Don't wait for import validation results |
| ansible-galaxy --disable-gpg-verify | Disable GPG signature verification when installing |
| ansible-galaxy --force-with-deps | Force overwriting an existing collection |
| ansible-galaxy --ignore-signature-status-code | ==SUPPRESS== |
| ansible-galaxy --ignore-signature-status-codes | A space separated list of status codes to ignore |
| ansible-galaxy --keyring <KEYRING> | The keyring used during signature verification |
| ansible-galaxy --offline | Install collection artifacts (tarballs) without |
| ansible-galaxy --signature | An additional signature source to verify |
| ansible-galaxy -U | Upgrade installed collection artifacts |
| ansible-galaxy -i | Ignore errors during installation and continue |
| ansible-galaxy -p <COLLECTIONS_PATH> | The path to the directory containing |
| ansible-galaxy --format <OUTPUT_FORMAT> | Format to display the list of collections |
| ansible-galaxy -p | One or more directories to search for collections |
| ansible-galaxy --role-skeleton <ROLE_SKELETON> | The path to a role skeleton that the new role |
| ansible-galaxy --type <ROLE_TYPE> | Initialize using an alternate role type |
| ansible-galaxy --author <AUTHOR> | GitHub username |
| ansible-galaxy --galaxy-tags <GALAXY_TAGS> | List of galaxy tags to filter |
| ansible-galaxy --platforms <PLATFORMS> | List of OS platforms to filter |
| ansible-galaxy --branch <REFERENCE> | The name of a branch to import |
| ansible-galaxy --role-name <ROLE_NAME> | The name the role should have, if different than |
| ansible-galaxy --status | Check the status of the most recent import request |
| ansible-galaxy --list | List all of your integrations |
| ansible-galaxy --remove <REMOVE_ID> | Remove the integration matching the provided ID |
| ansible-galaxy -g | Use tar instead of the scm archive option |
Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"