让我们考虑以下命令:
command: "curl http://{{ my_server }}:1234/xaw?x={{ x }}&y={{ y }}&z={{ z }}""
如何在很多行中编写它,例如:
command:
"curl http://{{ my_server }}:1234/xaw?
x={{ x }}&
y={{ y }}&
z={{ z }}"
答案 0 :(得分:0)
您可以在行末添加一个“ \”:
- hosts: all
tasks:
- set_fact:
my_server: "x"
ax: "x"
ay: "y"
az: "z"
- set_fact:
yourCommand: "curl http://{{ my_server }}:\
1234/xaw?x={{ ax }}\
&y={{ ay }}\
&z={{ az }}"
- debug:
var: yourCommand