Tool cheatsheet
Ansible 2 Cheatsheet
Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
Ad-hoc commands
- Check the Ansible version — Print the version, config file and module paths.
- Ping all hosts — Test that Ansible can connect to every host in the inventory.
- Run a command on a group — Run a shell command on every host in the webservers group.
- Show a host's facts — Print the facts Ansible collects about a host.
- Copy a file to hosts — Copy a file with the copy module.
- Restart a service — Restart a service on a group of hosts.
Playbooks
- Run a playbook — Run a playbook against an inventory.
- Dry run with diff — Show what would change, without changing anything.
- Check playbook syntax — Check the playbook for syntax errors without running it.
- Limit to some hosts — Run only against one host or group from the play.
- Run only tagged tasks — Run tasks that have a given tag.
- Pass variables — Set a variable on the command line, which overrides other sources.
- Ask for the sudo password — Prompt for the password used for privilege escalation.
- Increase verbosity — Show connection details. Add more v's for more detail.
- List the tasks in a playbook — Show the tasks and hosts without running anything.
- Playbook skeleton — A minimal playbook that installs and starts nginx.
Inventory, roles and collections
- Show the inventory — Print the inventory as JSON, with variables.
- Show the inventory as a tree — Print the groups and hosts as a tree.
- Install a role — Download a role from Ansible Galaxy.
- Install a collection — Download a collection from Ansible Galaxy.
- Install from a requirements file — Install the roles and collections listed in requirements.yml.
- Create a role skeleton — Create the standard folder layout for a role.
- Read module documentation — Show a module's options and examples in the terminal.
- Lint playbooks — Check playbooks for style problems and common mistakes. Needs ansible-lint installed.
Vault (secrets)
- Create an encrypted file — Create a new file that is encrypted at rest. You are asked for a vault password.
- Edit an encrypted file — Decrypt, edit and re-encrypt a file.
- Encrypt an existing file — Encrypt an existing file in place.
- View an encrypted file — Print the decrypted contents without changing the file.
- Run a playbook that uses vault — Prompt for the vault password when the playbook runs.
Related cheatsheets
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.
- Claude Code cheatsheet — Run Claude Code in the terminal: starting sessions, slash commands, permissions, CLAUDE.md, hooks, MCP servers and headless use.