Ansible Commands

Complete Ansible commands reference — 130 commands across 4 categories. Quick reference cheat sheet for Linux & Mac.

ansible (ad-hoc) (37)

ShortcutAction
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-cacheClear the fact cache for every host in inventory
ansible --list-hostsOutputs 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-idThe vault identity to use
ansible --vault-password-fileVault password file
ansible --versionShow program's version number, config file
ansible -B <SECONDS>Run asynchronously, failing after X seconds
ansible -CDon't make any changes
ansible -DWhen changing (small) files and templates, show
ansible -JAsk for vault password
ansible -KAsk for privilege escalation password
ansible -MPrepend 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 -bRun operations with become (does not imply password
ansible -c <CONNECTION>Connection type to use
ansible -eSet additional variables as key=value or YAML/JSON
ansible -f <FORKS>Specify number of parallel processes to use
ansible -hShow this help message and exit
ansible -iSpecify inventory host path or comma separated host
ansible -kAsk for connection password
ansible -l <SUBSET>Further limit selected hosts to an additional
ansible -m <MODULE_NAME>Name of the action to execute
ansible -oCondense output
ansible -t <TREE>Log output to this directory
ansible -u <REMOTE_USER>Connect as this user
ansible -vCauses Ansible to print more debug messages

ansible-playbook (36)

ShortcutAction
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-cacheClear the fact cache for every host in inventory
ansible-playbook --force-handlersRun handlers even if a task fails
ansible-playbook --list-hostsOutputs a list of matching hosts
ansible-playbook --list-tagsList all available tags
ansible-playbook --list-tasksList 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-tagsOnly 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 --stepOne-step-at-a-time: confirm each task before running
ansible-playbook --syntax-checkPerform a syntax check on the playbook, but do not
ansible-playbook --vault-idThe vault identity to use
ansible-playbook --vault-password-fileVault password file
ansible-playbook --versionShow program's version number, config file
ansible-playbook -CDon't make any changes
ansible-playbook -DWhen changing (small) files and templates, show
ansible-playbook -JAsk for vault password
ansible-playbook -KAsk for privilege escalation password
ansible-playbook -MPrepend colon-separated path(s) to module library
ansible-playbook -T <TIMEOUT>Override the connection timeout in seconds
ansible-playbook -bRun operations with become (does not imply password
ansible-playbook -c <CONNECTION>Connection type to use
ansible-playbook -eSet additional variables as key=value or YAML/JSON
ansible-playbook -f <FORKS>Specify number of parallel processes to use
ansible-playbook -hShow this help message and exit
ansible-playbook -iSpecify inventory host path or comma separated host
ansible-playbook -kAsk for connection password
ansible-playbook -l <SUBSET>Further limit selected hosts to an additional
ansible-playbook -tOnly run plays and tasks tagged with these values
ansible-playbook -u <REMOTE_USER>Connect as this user
ansible-playbook -vCauses Ansible to print more debug messages

ansible-vault (14)

ShortcutAction
ansible-vault --versionShow program's version number, config file
ansible-vault -hShow this help message and exit
ansible-vault -vCauses 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-checkAllows editor to be opened when no tty attached
ansible-vault --vault-idThe vault identity to use
ansible-vault --vault-password-fileVault password file
ansible-vault -JAsk for vault password
ansible-vault --output <OUTPUT_FILE>Output file name for encrypt or decrypt
ansible-vault --show-inputDo not hide input when prompted for the string
ansible-vault --stdin-name <ENCRYPT_STRING_STDIN_NAME>Specify the variable name for stdin
ansible-vault -nSpecify the variable name
ansible-vault -pPrompt for the string to encrypt
ansible-vault --new-vault-id <NEW_VAULT_ID>The new vault identity to use for rekey

ansible-galaxy (43)

ShortcutAction
ansible-galaxy --versionShow program's version number, config file
ansible-galaxy -hShow this help message and exit
ansible-galaxy -vCauses Ansible to print more debug messages
ansible-galaxy --clear-response-cacheClear the existing server response cache
ansible-galaxy --no-cacheDo not use the server response cache
ansible-galaxy --preInclude 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 -cIgnore SSL certificate validation errors
ansible-galaxy -nDon'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 -eSet additional variables as key=value or YAML/JSON
ansible-galaxy -fForce 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-waitDon't wait for import validation results
ansible-galaxy --disable-gpg-verifyDisable GPG signature verification when installing
ansible-galaxy --force-with-depsForce overwriting an existing collection
ansible-galaxy --ignore-signature-status-code==SUPPRESS==
ansible-galaxy --ignore-signature-status-codesA space separated list of status codes to ignore
ansible-galaxy --keyring <KEYRING>The keyring used during signature verification
ansible-galaxy --offlineInstall collection artifacts (tarballs) without
ansible-galaxy --signatureAn additional signature source to verify
ansible-galaxy -UUpgrade installed collection artifacts
ansible-galaxy -iIgnore 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 -pOne 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 --statusCheck the status of the most recent import request
ansible-galaxy --listList all of your integrations
ansible-galaxy --remove <REMOVE_ID>Remove the integration matching the provided ID
ansible-galaxy -gUse tar instead of the scm archive option
📄 View Printable Cheat Sheet — Download as PDF or print · 🧩 Combine with other tools

Related Shortcut Pages

Terraform Kubernetes (kubectl) Docker Vagrant PowerShell Podman

Search 13,500+ shortcuts across 269 platforms

Explore All Platforms Practice Shortcuts
📜 Every shortcut on this page is taken from the official Ansible documentation — docs.ansible.com
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.

🤖 Ask AI about Ansible shortcuts

Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"

ChatGPT Claude Perplexity Gemini Grok