我正在尝试使用gcp_compute插件通过GCE标签解析ansible动态库存文件。我花了一些时间设法运行插件,才能真正正确地获得主机,但是由于某种原因,ansible清单为组名添加了下划线前缀,即使该前缀留为空白。
每当我使用以下stock.gcp.yml文件运行ansible-inventory时:
plugin: gcp_compute
projects:
- terzbx
filters:
keyed_groups:
- key: tags['items']
auth_kind: serviceaccount
service_account_file: /root/deployment/MY_SERVICEACCOUNT.json
我收到的输出是:
"all": {
"children": [
"__built_in_method_items_of_dict_object_at_0x2bc4db0_",
"_analytics",
"_consul_server",
"_dashboardapi",
"_elasticsearch",
"_http_server",
"_https_server",
"_inventory",
"_k2bq",
"_kafka",
"_kibana",
"_logstash_k2bq",
"_logstash_k2es",
"_mysql",
"_neo4j",
"_ssl_offload",
"_zookeeper",
"ungrouped"
]
我希望是这样
"all": {
"children": [
"_built_in_method_items_of_dict_object_at_0x2bc4db0_",
"analytics",
"consul_server",
"dashboardapi",
"elasticsearch",
"http_server",
"https_server",
"inventory",
"k2bq",
"kafka",
"kibana",
"logstash_k2bq",
"logstash_k2es",
"mysql",
"neo4j",
"ssl_offload",
"zookeeper",
"ungrouped"
]
有人遇到过这个问题吗?我可以做些什么来获得所需的输出吗?
预先感谢您的帮助:)
答案 0 :(得分:0)
遇到同样的问题,您应该尝试一下:
{{1}}