Use credentials_file for GCE module auth config
This commit is contained in:
parent
e6b7b17326
commit
ec178225b0
4 changed files with 43 additions and 13 deletions
|
@ -63,9 +63,15 @@ options:
|
|||
pem_file:
|
||||
version_added: "1.5.1"
|
||||
description:
|
||||
- path to the pem file associated with the service account email
|
||||
- (deprecated) path to the pem file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
credentials_file:
|
||||
version_added: 2.1.0
|
||||
description:
|
||||
- path to the JSON file associated with the service account email
|
||||
default: null
|
||||
required: false
|
||||
project_id:
|
||||
version_added: "1.5.1"
|
||||
description:
|
||||
|
@ -129,7 +135,7 @@ options:
|
|||
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
- "apache-libcloud >= 0.13.3"
|
||||
- "apache-libcloud >= 0.17.0"
|
||||
notes:
|
||||
- Either I(name) or I(instance_names) is required.
|
||||
author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
||||
|
@ -162,13 +168,13 @@ EXAMPLES = '''
|
|||
image: debian-6
|
||||
zone: us-central1-a
|
||||
service_account_email: unique-email@developer.gserviceaccount.com
|
||||
pem_file: /path/to/pem_file
|
||||
credentials_file: /path/to/json_file
|
||||
project_id: project-id
|
||||
tasks:
|
||||
- name: Launch instances
|
||||
local_action: gce instance_names={{names}} machine_type={{machine_type}}
|
||||
image={{image}} zone={{zone}} service_account_email={{ service_account_email }}
|
||||
pem_file={{ pem_file }} project_id={{ project_id }}
|
||||
credentials_file={{ credentials_file }} project_id={{ project_id }}
|
||||
register: gce
|
||||
- name: Wait for SSH to come up
|
||||
local_action: wait_for host={{item.public_ip}} port=22 delay=10
|
||||
|
@ -445,6 +451,7 @@ def main():
|
|||
service_account_email = dict(),
|
||||
service_account_permissions = dict(type='list'),
|
||||
pem_file = dict(),
|
||||
credentials_file = dict(),
|
||||
project_id = dict(),
|
||||
ip_forward = dict(type='bool', default=False),
|
||||
external_ip = dict(choices=['ephemeral', 'none'],
|
||||
|
@ -456,7 +463,7 @@ def main():
|
|||
if not HAS_PYTHON26:
|
||||
module.fail_json(msg="GCE module requires python's 'ast' module, python v2.6+")
|
||||
if not HAS_LIBCLOUD:
|
||||
module.fail_json(msg='libcloud with GCE support (0.13.3+) required for this module')
|
||||
module.fail_json(msg='libcloud with GCE support (0.17.0+) required for this module')
|
||||
|
||||
gce = gce_connect(module)
|
||||
|
||||
|
|
|
@ -119,10 +119,16 @@ options:
|
|||
pem_file:
|
||||
version_added: "1.6"
|
||||
description:
|
||||
- path to the pem file associated with the service account email
|
||||
- (deprecated) path to the pem file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
aliases: []
|
||||
credentials_file:
|
||||
version_added: 2.1.0
|
||||
description:
|
||||
- path to the JSON file associated with the service account email
|
||||
default: null
|
||||
required: false
|
||||
project_id:
|
||||
version_added: "1.6"
|
||||
description:
|
||||
|
@ -133,7 +139,7 @@ options:
|
|||
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
- "apache-libcloud >= 0.13.3"
|
||||
- "apache-libcloud >= 0.17.0"
|
||||
author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
||||
'''
|
||||
|
||||
|
@ -182,6 +188,7 @@ def main():
|
|||
state = dict(default='present'),
|
||||
service_account_email = dict(),
|
||||
pem_file = dict(),
|
||||
credentials_file = dict(),
|
||||
project_id = dict(),
|
||||
)
|
||||
)
|
||||
|
|
|
@ -90,7 +90,14 @@ options:
|
|||
pem_file:
|
||||
version_added: "1.6"
|
||||
description:
|
||||
- path to the pem file associated with the service account email
|
||||
- (deprecated) path to the pem file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
aliases: []
|
||||
credentials_file:
|
||||
version_added: "2.1.0"
|
||||
description:
|
||||
- path to the JSON file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
aliases: []
|
||||
|
@ -104,7 +111,7 @@ options:
|
|||
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
- "apache-libcloud >= 0.13.3"
|
||||
- "apache-libcloud >= 0.17.0"
|
||||
author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
||||
'''
|
||||
|
||||
|
@ -177,12 +184,13 @@ def main():
|
|||
state = dict(default='present'),
|
||||
service_account_email = dict(),
|
||||
pem_file = dict(),
|
||||
credentials_file = dict(),
|
||||
project_id = dict(),
|
||||
)
|
||||
)
|
||||
|
||||
if not HAS_LIBCLOUD:
|
||||
module.exit_json(msg='libcloud with GCE support (0.13.3+) required for this module')
|
||||
module.exit_json(msg='libcloud with GCE support (0.17.0+) required for this module')
|
||||
|
||||
gce = gce_connect(module)
|
||||
|
||||
|
|
|
@ -97,7 +97,14 @@ options:
|
|||
pem_file:
|
||||
version_added: "1.6"
|
||||
description:
|
||||
- path to the pem file associated with the service account email
|
||||
- (deprecated) path to the pem file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
aliases: []
|
||||
credentials_file:
|
||||
version_added: "2.1.0"
|
||||
description:
|
||||
- path to the JSON file associated with the service account email
|
||||
required: false
|
||||
default: null
|
||||
aliases: []
|
||||
|
@ -119,7 +126,7 @@ options:
|
|||
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
- "apache-libcloud >= 0.13.3"
|
||||
- "apache-libcloud >= 0.17.0"
|
||||
author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
||||
'''
|
||||
|
||||
|
@ -158,11 +165,12 @@ def main():
|
|||
zone = dict(default='us-central1-b'),
|
||||
service_account_email = dict(),
|
||||
pem_file = dict(),
|
||||
credentials_file = dict(),
|
||||
project_id = dict(),
|
||||
)
|
||||
)
|
||||
if not HAS_LIBCLOUD:
|
||||
module.fail_json(msg='libcloud with GCE support (0.13.3+) is required for this module')
|
||||
module.fail_json(msg='libcloud with GCE support (0.17.0+) is required for this module')
|
||||
|
||||
gce = gce_connect(module)
|
||||
|
||||
|
|
Loading…
Reference in a new issue