Answer the question
In order to leave comments, you need to log in
Why doesn't AWX see the plugin?
There is AWX which should create a virtual machine in GCP . To do this, I installed the plugin sudo pip install google-auth
Here is the actual playbook code:
---
- name: Create jenkins vm
hosts: localhost
connection: local
gather_facts: no
vars:
service_account_email: [email protected]
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 }}"
[[email protected] ansible]$ ansible-playbook myplaybook.yml
ansible-playbook 2.8.6
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /tmp/awx_20_i7oi_i6v/tmpsz28t9kv as it did not pass it's verify_file() method
Parsed /tmp/awx_20_i7oi_i6v/tmpsz28t9kv inventory source with script plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAYBOOK: createvm.yml *********************************************************
1 plays in createvm.yml
PLAY [Create jenkins vm] *******************************************************
META: ran handlers
TASK [Launch instances] ********************************************************
task path: /tmp/awx_20_i7oi_i6v/project/createvm.yml:15
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740 `" && echo ansible-tmp-1572876378.6-183253348571740="` echo /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740 `" ) && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/google/gcp_compute_instance.py
<127.0.0.1> PUT /var/lib/awx/.ansible/tmp/ansible-local-379jmWiYK/tmpYS1Si3 TO /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740/AnsiballZ_gcp_compute_instance.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740/ /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740/AnsiballZ_gcp_compute_instance.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740/AnsiballZ_gcp_compute_instance.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1572876378.6-183253348571740/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"auth_kind": "serviceaccount",
"can_ip_forward": null,
"disks": [
{
"auto_delete": true,
"boot": true,
"device_name": null,
"disk_encryption_key": null,
"index": null,
"initialize_params": {
"disk_name": null,
"disk_size_gb": null,
"disk_type": null,
"source_image": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20191014",
"source_image_encryption_key": nu…
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
{
"_ansible_no_log": false,
"invocation": {
"module_args": {
"status": null,
"scopes": [
"https://www.googleapis.com/auth/compute"
],
"service_account_contents": null,
"network_interfaces": [
{
"access_configs": [
{
"type": "ONE_TO_ONE_NAT",
"name": "External NAT",
"nat_ip": null
}
],
"subnetwork": null,
"network_ip": null,
"network": null,
"alias_ip_ranges": null
}
],
"machine_type": "f1-micro",
"tags": null,
"service_accounts": null,
"guest_accelerators": null,
"can_ip_forward": null,
"scheduling": null,
"service_account_file": "/etc/conf/awx/awx.json",
"name": "jenkins-node-1",
"zone": "europe-north1-a",
"service_account_email": null,
"disks": [
{
"index": null,
"auto_delete": true,
"boot": true,
"device_name": null,
"source": null,
"mode": null,
"interface": null,
"initialize_params": {
"disk_type": null,
"source_image_encryption_key": null,
"source_image": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20191014",
"disk_name": null,
"disk_size_gb": null
},
"type": null,
"disk_encryption_key": null
}
],
"project": "geocitizen-app",
"state": "present",
"min_cpu_platform": null,
"auth_kind": "serviceaccount",
"label_fingerprint": null,
"metadata": null
}
},
"changed": false,
"msg": "Please install the google-auth library"
}
"msg": "Please install the google-auth library"
. Above we were told that our libraries are hereansible python module location = /usr/lib/python2.7/site-packages/ansible
Here is what we have in this folder[[email protected] ansible]$ pwd
/usr/lib/python2.7/site-packages/ansible
[[email protected] ansible]$ ls
bin galaxy pyasn1-0.4.7.dist-info
cachetools google pyasn1_modules
cachetools-3.1.1.dist-info google_auth-1.6.3.dist-info pyasn1_modules-0.2.7.dist-info
cli google_auth-1.6.3-py3.5-nspkg.pth release.py
compat __init__.py release.pyc
config __init__.pyc release.pyo
constants.py __init__.pyo rsa
constants.pyc inventory rsa-4.0.dist-info
constants.pyo modules six-1.12.0.dist-info
context.py module_utils six.py
context.pyc parsing six.pyc
context.pyo playbook template
errors plugins utils
executor pyasn1 vars
[[email protected] ansible]$ sudo pip install --target=/usr/lib/python2.7/site-packages/ansible google-auth
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question