summaryrefslogtreecommitdiffstats
path: root/ansible_collections/google/cloud/plugins/inventory
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
commit7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch)
treeefb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/google/cloud/plugins/inventory
parentReleasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff)
downloadansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz
ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.zip
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/google/cloud/plugins/inventory')
-rw-r--r--ansible_collections/google/cloud/plugins/inventory/gcp_compute.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py b/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py
index d380acd96..f4743b292 100644
--- a/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py
+++ b/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py
@@ -39,7 +39,7 @@ DOCUMENTATION = """
description: >
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/compute/docs/reference/rest/v1/instances/aggregatedList).
- Each additional filter in the list will act be added as an AND condition
+ Each additional filter in the list will be added as an AND condition
(filter1 and filter2)
type: list
hostnames:
@@ -57,7 +57,7 @@ DOCUMENTATION = """
description:
- The type of credential used.
required: True
- choices: ['application', 'serviceaccount', 'machineaccount']
+ choices: ['application', 'serviceaccount', 'machineaccount', 'accesstoken']
env:
- name: GCP_AUTH_KIND
scopes:
@@ -86,6 +86,11 @@ DOCUMENTATION = """
and the user does not wish to use the default email.
env:
- name: GCP_SERVICE_ACCOUNT_EMAIL
+ access_token:
+ description:
+ - An OAuth2 access token if credential type is accesstoken.
+ env:
+ - name: GCP_ACCESS_TOKEN
vars_prefix:
description: prefix to apply to host variables, does not include facts nor params
default: ''
@@ -232,7 +237,8 @@ class GcpInstance(object):
for order in self.hostname_ordering:
name = None
if order.startswith("labels."):
- name = self.json["labels"].get(order[7:])
+ if "labels" in self.json:
+ name = self.json["labels"].get(order[7:])
elif order == "public_ip":
name = self._get_publicip()
elif order == "private_ip":
@@ -558,6 +564,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
"service_account_file": self.get_option("service_account_file"),
"service_account_contents": self.get_option("service_account_contents"),
"service_account_email": self.get_option("service_account_email"),
+ "access_token": self.get_option("access_token"),
}
self.fake_module = GcpMockModule(params)