CLI
Basis
ansible all -m pingCheck if all hosts (specified in the inventory file) are reachable.
ansible myHosts -a "whoami"Execute command on myHosts (specified in the inventory file).
ansible-playbook myPlaybook.ymlExecute a playbook.
Inventory
ansible-inventory -i myHostsFile --listList hosts in the inventory.
ansible-inventory -i myHostsFile --list --yaml --output myHostsFile.ymlConvert inventory file format form INI to YAML.
Vault
ansible-vault create secret.ymlCreate a secure file (secured by password) to store secrets.
ansible-vault edit secret.ymlEdit the secure file.
Flags
-iSpecify inventory file to use.
-u myUserExecute command as myUser.
-kPrompt user to enter SSH password.
--becomeUse sudo when executing commands.
-KPrompt user to enter Become password.
---ask-vault-passPrompt user to enter Secure Variables's Vault password.
-cShow expected output of playbook (
--check
).-dShow details of the changes (
--diff
).