debugモジュールを使うと、実行中のステートメントを表示できる。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
- name: Print the gateway for each host when defined ansible.builtin.debug: msg: System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }} when: ansible_default_ipv4.gateway is defined - name: Get uptime information ansible.builtin.shell: /usr/bin/uptime register: result - name: Print return information from the previous task ansible.builtin.debug: var: result verbosity: 2 |
参考サイト
ansible.builtin.debug module – Print statements during execution — Ansible Documentation
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debug_module.html
Ansible モジュール debug – Qiita
https://qiita.com/CsFactoryitter/items/6f1b5464b7a44b5e0c13