|
|
@ -121,13 +121,13 @@ EXAMPLES = '''
|
|
|
|
zone: us-central1-a
|
|
|
|
zone: us-central1-a
|
|
|
|
tasks:
|
|
|
|
tasks:
|
|
|
|
- name: Launch instances
|
|
|
|
- name: Launch instances
|
|
|
|
local_action: gce instance_names=${names} machine_type=${machine_type}
|
|
|
|
local_action: gce instance_names={{names}} machine_type={{machine_type}}
|
|
|
|
image=${image} zone=${zone}
|
|
|
|
image={{image}} zone={{zone}}
|
|
|
|
register: gce
|
|
|
|
register: gce
|
|
|
|
- name: Wait for SSH to come up
|
|
|
|
- name: Wait for SSH to come up
|
|
|
|
local_action: wait_for host=${item.public_ip} port=22 delay=10
|
|
|
|
local_action: wait_for host={{item.public_ip}} port=22 delay=10
|
|
|
|
timeout=60 state=started
|
|
|
|
timeout=60 state=started
|
|
|
|
with_items: ${gce.instance_data}
|
|
|
|
with_items: {{gce.instance_data}}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Configure instance(s)
|
|
|
|
- name: Configure instance(s)
|
|
|
|
hosts: launched
|
|
|
|
hosts: launched
|
|
|
@ -144,7 +144,7 @@ EXAMPLES = '''
|
|
|
|
local_action:
|
|
|
|
local_action:
|
|
|
|
module: gce
|
|
|
|
module: gce
|
|
|
|
state: 'absent'
|
|
|
|
state: 'absent'
|
|
|
|
instance_names: ${gce.instance_names}
|
|
|
|
instance_names: {{gce.instance_names}}
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -211,8 +211,8 @@ def get_instance_info(inst):
|
|
|
|
'metadata': metadata,
|
|
|
|
'metadata': metadata,
|
|
|
|
'name': inst.name,
|
|
|
|
'name': inst.name,
|
|
|
|
'network': netname,
|
|
|
|
'network': netname,
|
|
|
|
'private_ip': inst.private_ip[0],
|
|
|
|
'private_ip': inst.private_ips[0],
|
|
|
|
'public_ip': inst.public_ip[0],
|
|
|
|
'public_ip': inst.public_ips[0],
|
|
|
|
'status': ('status' in inst.extra) and inst.extra['status'] or None,
|
|
|
|
'status': ('status' in inst.extra) and inst.extra['status'] or None,
|
|
|
|
'tags': ('tags' in inst.extra) and inst.extra['tags'] or [],
|
|
|
|
'tags': ('tags' in inst.extra) and inst.extra['tags'] or [],
|
|
|
|
'zone': ('zone' in inst.extra) and inst.extra['zone'].name or None,
|
|
|
|
'zone': ('zone' in inst.extra) and inst.extra['zone'].name or None,
|
|
|
@ -344,7 +344,7 @@ def main():
|
|
|
|
instance_names = dict(),
|
|
|
|
instance_names = dict(),
|
|
|
|
machine_type = dict(default='n1-standard-1'),
|
|
|
|
machine_type = dict(default='n1-standard-1'),
|
|
|
|
metadata = dict(),
|
|
|
|
metadata = dict(),
|
|
|
|
name = dict(default='gce'),
|
|
|
|
name = dict(),
|
|
|
|
network = dict(default='default'),
|
|
|
|
network = dict(default='default'),
|
|
|
|
persistent_boot_disk = dict(type='bool', choices=BOOLEANS, default=False),
|
|
|
|
persistent_boot_disk = dict(type='bool', choices=BOOLEANS, default=False),
|
|
|
|
state = dict(choices=['active', 'present', 'absent', 'deleted'],
|
|
|
|
state = dict(choices=['active', 'present', 'absent', 'deleted'],
|
|
|
|