尝试格式化有效的动态广告资源。怎么做?
这是针对脚本的,它将获取terraform的状态文件并将其保存到可用清单中。我需要知道Ansible中使用的动态广告资源的格式。
我尝试运行以下清单:ansible all -i test.json -m ping
{
"_meta": {
"hostvars": { }
},
"instances": {
"hosts": ["10.66.70.33"]
}
}
结果:
[WARNING]: * Failed to parse /etc/ansible/test.json with yaml plugin: Invalid "hosts" entry for "instances" group,
requires a dictionary, found "<type 'list'>" instead.
[WARNING]: * Failed to parse /etc/ansible/test.json with ini plugin: /etc/ansible/test.json:2: Expected
key=value host variable assignment, got: {
[WARNING]: Unable to parse /etc/ansible/test.json as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{ | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname {: Temporary failure in name resolution",
"unreachable": true
}
答案 0 :(得分:0)
找到一种有效的格式:
{
"all": {
"hosts": "10.66.70.33",
"children": {
"instances": {
"hosts": {
"10.66.70.33":
}
}
}
}
}