1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

GCP Inventory Plugin scopes fix

This commit is contained in:
Alex Stephen 2018-06-07 21:05:58 +00:00 committed by Matt Clay
parent 91803c6ad3
commit 77b54a3267
2 changed files with 13 additions and 1 deletions

View file

@ -106,6 +106,9 @@ class GcpSession(object):
if not HAS_GOOGLE_LIBRARIES: if not HAS_GOOGLE_LIBRARIES:
self.module.fail_json(msg="Please install the google-auth library") self.module.fail_json(msg="Please install the google-auth library")
if 'auth_kind' not in self.module.params:
self.module.fail_json(msg="Auth kind parameter is missing")
if self.module.params.get('service_account_email') is not None and self.module.params['auth_kind'] != 'machineaccount': if self.module.params.get('service_account_email') is not None and self.module.params['auth_kind'] != 'machineaccount':
self.module.fail_json( self.module.fail_json(
msg="Service Acccount Email only works with Machine Account-based authentication" msg="Service Acccount Email only works with Machine Account-based authentication"

View file

@ -12,7 +12,6 @@ DOCUMENTATION = '''
- requests >= 2.18.4 - requests >= 2.18.4
- google-auth >= 1.3.0 - google-auth >= 1.3.0
extends_documentation_fragment: extends_documentation_fragment:
- gcp
- constructed - constructed
- inventory_cache - inventory_cache
description: description:
@ -35,6 +34,16 @@ DOCUMENTATION = '''
hostnames should be assigned. Currently supported hostnames are hostnames should be assigned. Currently supported hostnames are
'public_ip', 'private_ip', or 'name'. 'public_ip', 'private_ip', or 'name'.
default: ['public_ip', 'private_ip', 'name'] default: ['public_ip', 'private_ip', 'name']
auth_kind:
description:
- The type of credential used.
service_account_file:
description:
- The path of a Service Account JSON file if serviceaccount is selected as type.
service_account_email:
description:
- An optional service account email address if machineaccount is selected
and the user does not wish to use the default email.
''' '''
EXAMPLES = ''' EXAMPLES = '''