使い方
helpを見るとこんな感じになっています。 *バージョンは2.4.3
bash-3.2$ ansible-doc -h
Usage: ansible-doc [-l|-s] [options] [-t <plugin type] [plugin]
plugin documentation tool
Options:
-a, --all **For internal testing only** Show documentation for
all plugins.
-h, --help show this help message and exit
-l, --list List available plugins
-M MODULE_PATH, --module-path=MODULE_PATH
prepend colon-separated path(s) to module library
(default=[u'/Users/koh/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules'])
-s, --snippet Show playbook snippet for specified plugin(s)
-t TYPE, --type=TYPE Choose which plugin type (defaults to "module")
-v, --verbose verbose mode (-vvv for more, -vvvv to enable
connection debugging)
--version show program's version number and exit
See man pages for Ansible CLI options or website for tutorials
https://docs.ansible.com
bash-3.2$
ansible-doc モジュールでモジュールの詳細がpagerで見ることができます。
内容はAnsibleの公式ドキュメントと同様に概要、オプション、例などが記載されています。
bash-3.2$ ansible-doc debug
> DEBUG (/usr/local/Cellar/ansible/2.4.3.0_1/libexec/lib/python2.7/site-packages/ansible/modules/u
This module prints statements during execution and can be useful for
debugging variables or expressions without necessarily halting the
playbook. Useful for debugging together with the 'when:' directive. This
module is also supported for Windows targets.
* note: This module has a corresponding action plugin.
OPTIONS (= is mandatory):
- msg
The customized message that is printed. If omitted, prints a generic
message.
[Default: Hello world!]
- var
A variable name to debug. Mutually exclusive with the 'msg' option.
[Default: (null)]
- verbosity
A number that controls when the debug is run, if you set to 3 it will
only run debug when -vvv or above
[Default: 0]
version_added: 2.1
NOTES:
* This module is also supported for Windows targets.
AUTHOR: Dag Wieers (@dagwieers), Michael DeHaan
METADATA:
status:
- stableinterface
supported_by: core
EXAMPLES:
# Example that prints the loopback address and gateway for each host
- debug:
msg: "System {{ inventory_hostname }} has uuid {{ ansible_product_uuid }}"
- debug:
msg: "System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}"
when: ansible_default_ipv4.gateway is defined
- shell: /usr/bin/uptime
register: result
- debug:
var: result
verbosity: 2
- name: Display all variables/facts known for a host
debug:
var: hostvars[inventory_hostname]
verbosity: 4
(END)