我想确保IP或域是已知主机::
{
"datarow1":{
"Club":[
{
"club.name":"FC Bar"
},
{
"coach":{
"coach.fname":[
"Hari",
"Shyam",
"Parbe"
]
}
},
{
"player":[
{
"player.fname":[
"King",
"Leo",
"Singh"
]
},
{
"player.lname":[
"Dev",
"Fin"
]
}
]
},
{
"participation":[
{
"participation.league":[
"la liga",
"UEFA"
]
}
]
}
]
},
"datarow2":{
"Club":[
{
"club.name":"FC TU"
},
{
"coach":{
"coach.fname":[
"Xavi",
"Hola",
"Them"
]
}
},
{
"player":[
{
"player.fname":[
"Sab",
"Hi",
"Suz"
]
},
{
"player.lname":[
"Messi",
"Aura"
]
}
]
},
{
"participation":[
{
"participation.league":[
"Italian",
"Premier"
]
}
]
}
]
},
}
但是在{= <...
中没有看到- name: Ensure IP or domain is a known host
lineinfile: >
dest={{ home }}/.ssh/known_hosts create=yes
state=present line="{{ lookup('pipe', 'ssh-keyscan -t ecdsa {{ item }}') }}"
with_items:
- 88.48.189.102
- my.site.com
我明白了:
{{item}}
答案 0 :(得分:3)
你不需要内花括号。您只需以这种方式将项连接为字符串:
{{ lookup('pipe', 'ssh-keyscan -t ecdsa ' ~ item) }}
或
{{ lookup('pipe', 'ssh-keyscan -t ecdsa ' + item) }}
但是jinja docs说第一个是首选方法。