🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[debug模块][1] 在运行过程中,打印变量的值 var 打印变量的完整信息,变量引用不用加括号 msg 客制化要打印的信息 verbosity A number that controls when the debug is run, if you set to 3 it will only run debug when -vvv or above ### 示例 ~~~ - name: show return value of cmd hosts: test tasks: - name: capture output of cmd command: id -un register: login - debug: var=login - debug: msg="{{ login.stdout }}" ~~~ ### 输出 注意stdout ~~~ TASK [debug] ******************************************************************************** ok: [192.168.101.175] => { "login": { "changed": true, "cmd": [ "id", "-un" ], "delta": "0:00:00.004760", "end": "2017-07-14 21:22:40.993368", "rc": 0, "start": "2017-07-14 21:22:40.988608", "stderr": "", "stderr_lines": [], "stdout": "root", "stdout_lines": [ "root" ] } } TASK [debug] ******************************************************************************** ok: [192.168.101.175] => { "msg": "root" } ~~~ [1]:http://docs.ansible.com/ansible/latest/debug_module.html