我正在使用ansible 2.9.3
,但在尝试从目标机器显示文件内容时遇到问题,这是我的剧本:
-
name: Display content of resolv.conf
hosts: jenkins
tasks:
- name: Display resolv.conf contents
command: cat resolv.conf chdir=/etc
register: command_output
- name: Print to console
debug: msg = "{{command_output.stdout}}"
我的任务Print to console
返回:
TASK [Print to console] ************************************************************************************************************************************************************************************
ok: [jenkins] => {
"msg": "Hello world!"
}
我想将文件的内容保存到标准输出,我错过了什么?谢谢
将 放在
msg
单独的一行而不是debug
这样,并使用 a:
而不是 a=
:这是我的输出:
删除等号“=”周围的空格