Ansible无法解析清单(gcp_compute插件)



尝试乒乓组中的所有实例,使用virtualenv,我已经用makefile安装了所有需要的包。我克隆了我项目的存储库,所以我需要说,这是在我同事的笔记本电脑(mac-intel(上进行的工作,但不是在我的笔记本电脑上(macm2(。

使用ansible all -i ./inventories/infra-dev/ -m ping

获取此输出

[WARNING]:  * Failed to parse /<some>/<some>/<some>/<some>-ansible/inventories/infra-dev/infra_dev_gcp.yaml with auto plugin: Invalid control character at: line 5 column 38 (char 170)
[WARNING]:  * Failed to parse /<some>/<some>/<some>/<some>-ansible/inventories/infra-dev/infra_dev_gcp.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse /<some>/<some>/<some>/<some>-ansible/inventories/infra-dev/infra_dev_gcp.yaml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a YAML
file.
[WARNING]: Unable to parse /<some>/<some>/<some>/<some>-ansible/inventories/infra-dev/infra_dev_gcp.yaml as an inventory source
[WARNING]: Unable to parse /<some>/<some>/<some>/<some>-ansible/inventories/infra-dev as an inventory source
ERROR! No inventory was parsed, please check your configuration and options. 

版本:

Package        Version
-------------- ---------
ansible        2.9.1
cachetools     4.2.4
certifi        2022.9.24
cffi           1.15.1
chardet        3.0.4
cryptography   38.0.3
google-auth    1.23.0
idna           2.10
Jinja2         3.1.2
MarkupSafe     2.1.1
pathspec       0.10.1
pip            22.3
pyasn1         0.4.8
pyasn1-modules 0.2.8
pycparser      2.21
PyYAML         6.0
requests       2.25.0
rsa            4.9
setuptools     65.5.0
six            1.16.0
urllib3        1.26.12
wheel          0.37.1
yamllint       1.23.0

库存文件:

plugin: gcp_compute
projects:
- <some>-<some>-<some>
keyed_groups:
- prefix: "gcp"
key: labels['group']
filters:
- labels.ecosystem = "dev" AND labels.ecolevel = "infra-dev"
auth_kind: serviceaccount
service_account_file: ~/.<some>/<some>-<some>-<some>.json
hostnames:
- name
compose:
ansible_host: networkInterfaces[0].networkIP

可能您的服务帐户文件错误或不存在:

service_account_file: ~/.<some>/<some>-<some>-<some>.json

您应该使用有效的服务帐户文件。您可以从以下位置获取此文件:https://console.cloud.google.com/apis/credentials?pli=1

遵循以下简单步骤:如何获取文件";service_account.json";谷歌翻译API?

然后放入yml配置

service_account_file: ~/service_account.json

或类似的

相关内容

  • 没有找到相关文章

最新更新