- Learning Ansible 2.7(Third Edition)
- Fabio Alessandro Locati
- 288字
- 2021-06-24 15:08:42
Ansible verbosity
One of the first options that anyone picks up is the debug option. To understand what is happening when you run the playbook, you can run it with the verbose (-v) option. Every extra v will provide the end user with more debug output.
Let's see an example of using those options to debug a simple ping command (ansible all -i test01.fale.io, -m ping):
- The -v option provides the default output:
Using /etc/ansible/ansible.cfg as config file
test01.fale.io | SUCCESS => {
"changed": false,
"ping": "pong"
}
- The -vv option adds a little more information about the Ansible environment and the handlers:
ansible 2.7.2
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/fale/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.15 (default, Oct 15 2018, 15:24:06) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]
Using /etc/ansible/ansible.cfg as config file
META: ran handlers
test01.fale.io | SUCCESS => {
"changed": false,
"ping": "pong"
}
META: ran handlers
META: ran handlers
- The -vvv option adds a lot more information. For instance, it shows the ssh command that Ansible uses to create a temporary file on the remote host and run the script remotely. Full script is available on GitHub.
ansible 2.7.2
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/fale/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.15 (default, Oct 15 2018, 15:24:06) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]
Using /etc/ansible/ansible.cfg as config file
Parsed test01.fale.io, inventory source with host_list plugin
META: ran handlers
<test01.fale.io> ESTABLISH SSH CONNECTION FOR USER: None
<test01.fale.io> SSH: EXEC ssh -C -o ControlMaster=auto -o
...
Now we understood what is happening when you run the playbook, with the verbose -vvv option.
推薦閱讀
- 同仁眼整形眼眶病診療手冊
- 小兒便秘100問
- 亞低溫神經(jīng)保護(hù)治療學(xué)
- 中華口腔醫(yī)學(xué)會團(tuán)體標(biāo)準(zhǔn)(2017—2022年)
- 甲狀腺疾病的核醫(yī)學(xué)診斷與治療
- 心理障礙的疏導(dǎo)自助
- 朱德生皮膚病學(xué)(第5版)
- 牙齒健康與口腔保健手冊
- Android Studio 4.0 Development Essentials(Java Edition)
- 臨床麻醉難點(diǎn)解析(第2版)
- 中國口腔疾病經(jīng)濟(jì)負(fù)擔(dān)和預(yù)防策略經(jīng)濟(jì)學(xué)評價(jià)研究
- 顱腦7.0T磁共振成像診斷學(xué)
- 運(yùn)動導(dǎo)致的骨骼肌細(xì)胞結(jié)構(gòu)損傷及其診斷
- 癌癥療愈錄:腫瘤門診敘事紀(jì)實(shí)二
- 圖解骨傷科痛癥治療手法