Skip to content

CLI tools

ansible

Define and run a single task ‘playbook’ against a set of hosts

ansible <host-pattern> [options]
Common options:
become-user <BECOME_USER> # run operations as this user (default=root)
--private-key, --key-file # use this file to authenticate the connection
--vault-id # the vault identity to use
--ask-vault-pass # ask for vault password
--vault-password-file # vault password file
-a <MODULE_ARGS>, --args <MODULE_ARGS> # module arguments
-b, --become # run operations with become
-e, --extra-vars # set additional variables as key=value or YAML/JSON, if filename prepend with @
-i, --inventory, --inventory-file # specify inventory host path or comma separated host list
-m <MODULE_NAME>, --module-name <MODULE_NAME> # module name to execute
-t <TREE>, --tree <TREE> # log output to this directory

ansible-config

  • View, edit, and manage ansible configuration
  • /etc/ansible/ansible.cfg – Config file, used if present
  • ~/.ansible.cfg – User config file, overrides the default config if present
    ansible-config [view|dump|list] [--help] [options] [ansible.cfg]
    

ansible-console

  • REPL console for executing Ansible tasks
  • a REPL that allows for running ad-hoc tasks against a chosen inventory (based on dominis’ ansible-shell)
    ansible-console [<host-pattern>] [options]