Ansible : sous-commandes
Ansible-doc
Ansible-doc permet d'avoir de la documentation sur un module directement en ligne de commande :
<source lang="zsh"> ~/Sandbox ansible-doc template
- Donne
> TEMPLATE (/usr/lib/python2.7/dist-packages/ansible/modules/files/template.py)
Templates are processed by the L(Jinja2 templating language,http://jinja.pocoo.org/docs/). Documentation on the template formatting can be found in the L(Template Designer Documentation,http://jinja.pocoo.org/docs/templates/). Additional variables
[...] - attributes
The attributes the resulting file or directory should have. To get supported flags look ...
[...] </source>
Ansible-config
La commande ansible-config sert à voir la config d'Ansible, tout simplement
<source lang="zsh"> ~/Sandbox ansible-config -h usage: ansible-config [-h] [--version] [-v] {list,dump,view} ...
View ansible configuration.
positional arguments:
{list,dump,view} list Print all config options dump Dump configuration view View configuration file
optional arguments:
--version show program's version number, config file location, configured module search path, module location, executable location and exit -h, --help show this help message and exit -v, --verbose verbose mode (-vvv for more, -vvvv to enable connection debugging)
</source>
Ansible-inventory
Utilisé pour voir / dumper l'inventaire au niveau "système" qu'Ansible voit <source lang="zsh"> ~/Sandbox ansible-inventory usage: ansible-inventory [-h] [--version] [-v] [-i INVENTORY]
[--vault-id VAULT_IDS] [--ask-vault-pass | --vault-password-file VAULT_PASSWORD_FILES] [--playbook-dir BASEDIR] [--list] [--host HOST] [--graph] [-y] [--toml] [--vars] [--export] [--output OUTPUT_FILE] [host|group]
positional arguments:
host|group
optional arguments:
--ask-vault-pass ask for vault password --export When doing an --list, represent in a way that is optimized for export,not as an accurate representation of how Ansible has processed it --output OUTPUT_FILE When doing --list, send the inventory to a file instead of to the screen --playbook-dir BASEDIR Since this tool does not use playbooks, use this as a substitute playbook directory.This sets the relative path for many features including roles/ group_vars/ etc. --toml Use TOML format instead of default JSON, ignored for --graph --vars Add vars to graph display, ignored unless used with --graph --vault-id VAULT_IDS the vault identity to use --vault-password-file VAULT_PASSWORD_FILES vault password file --version show program's version number, config file location, configured module search path, module location, executable location and exit -h, --help show this help message and exit -i INVENTORY, --inventory INVENTORY, --inventory-file INVENTORY specify inventory host path or comma separated host list. --inventory-file is deprecated -v, --verbose verbose mode (-vvv for more, -vvvv to enable connection debugging) -y, --yaml Use YAML format instead of default JSON, ignored for --graph
Actions:
One of following must be used on invocation, ONLY ONE!
--graph create inventory graph, if supplying pattern it must be a valid group name --host HOST Output specific host info, works as inventory script --list Output all hosts info, works as inventory script
Show Ansible inventory information, by default it uses the inventory script JSON format </source>
Ansible-console
Une ligne de commande pour exécuter des tâches Ad-Hoc. <source lang="zsh"> usage: ansible-console [-h] [--version] [-v] [-b]
[--become-method BECOME_METHOD] [--become-user BECOME_USER] [-K] [-i INVENTORY] [--list-hosts] [-l SUBSET] [-k] [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT] [--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EXTRA_ARGS] [--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args SSH_EXTRA_ARGS] [-C] [--syntax-check] [-D] [--vault-id VAULT_IDS] [--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES] [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR] [--step] [pattern]
</source>