我使用 AWX 8.0.0.0。在我的 SCM 上有工作,该工作连接到 GCP 并创建实例。当我在控制台下运行这项工作时,ansible-playbook job.yml
它做得很好。但是当我从 Web UI 运行它时,我得到了错误
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Please install the google-auth library"}
所以它不经意意味着我没有这个图书馆。但是我安装它
pip install google-auth
并且当我从控制台运行它时它工作正常。这是我的剧本:
- name: Create jenkins vm
hosts: localhost
connection: local
gather_facts: no
vars:
service_account_email: ansible@secret-app.iam.gserviceaccount.com
credentials_file: /etc/conf/awx/awx.json
project_id: geocitizen-app
machine_type: f1-micro
machine_name: jenkins-node-1
image: https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20191014
zone: europe-north1-a
tasks:
- name: Launch instances
gcp_compute_instance:
auth_kind: serviceaccount
name: "{{ machine_name }}"
machine_type: "{{ machine_type }}"
#service_account_email: "{{ service_account_email }}"
service_account_file: "{{ credentials_file }}"
project: "{{ project_id }}"
zone: "{{ zone }}"
network_interfaces:
- network:
access_configs:
- name: External NAT
type: ONE_TO_ONE_NAT
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: "{{ image }}"
我做错了什么?