Ansible
Agentless config management & orchestration over SSH.
Official docsAd-hoc commands
ansible all -m pingCheapest health check across the inventory — confirms SSH + python.
ansible all -m setupDump every fact (gathered variable) for every host.
ansible web -m shell -a 'uptime'Run an arbitrary shell command on a host group.
ansible web -m apt -a 'name=nginx state=present' -bInstall a package — -b becomes root.
ansible all -m copy -a 'src=./hosts dest=/etc/hosts' -bPush a file to every host.
Inventory
ansible-inventory --listPrint the inventory as JSON. Useful for dynamic inventory debugging.
ansible-inventory --graphTree view of groups + hosts.
ansible all --list-hostsJust the host names matching a pattern.
ansible -i hosts.ini web --list-hostsUse a non-default inventory file.
Playbooks
ansible-playbook site.ymlRun a playbook against the inventory.
ansible-playbook site.yml --checkDry-run: report what would change without applying.
ansible-playbook site.yml --diffShow before/after diffs for files Ansible modifies.
ansible-playbook site.yml --tags 'nginx,tls'Only tasks tagged matching.
ansible-playbook site.yml --limit web01Only run against one host (or pattern).
ansible-playbook site.yml -KPrompt for sudo (become) password.
Vault (secrets)
ansible-vault create secrets.ymlCreate a new encrypted file.
ansible-vault edit secrets.ymlDecrypt → open in $EDITOR → re-encrypt on save.
ansible-vault view secrets.ymlPrint the decrypted contents to stdout.
ansible-vault encrypt_string 'shh' --name 'db_password'Encrypt a single value to paste into a YAML file.
ansible-playbook site.yml --ask-vault-passPrompt for the vault password at runtime.
Roles & Galaxy
ansible-galaxy init my_roleScaffold a fresh role with the standard directory layout.
ansible-galaxy install -r requirements.ymlPull external roles/collections from Galaxy or git.
ansible-galaxy collection install community.generalInstall a collection.
ansible-galaxy role listList installed roles + their versions.