mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bug fixes for gcp_compute_instance_group_manager (#42817)
This commit is contained in:
parent
c239e6f045
commit
2a346af18b
2 changed files with 105 additions and 118 deletions
|
@ -65,7 +65,8 @@ options:
|
||||||
required: false
|
required: false
|
||||||
instance_template:
|
instance_template:
|
||||||
description:
|
description:
|
||||||
- A reference to InstanceTemplate resource.
|
- The instance template that is specified for this managed instance group. The group
|
||||||
|
uses this template to create all new instances in the managed instance group.
|
||||||
required: true
|
required: true
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
|
@ -100,7 +101,7 @@ options:
|
||||||
required: false
|
required: false
|
||||||
zone:
|
zone:
|
||||||
description:
|
description:
|
||||||
- A reference to Zone resource.
|
- The zone the managed instance group resides.
|
||||||
required: true
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
@ -108,24 +109,20 @@ extends_documentation_fragment: gcp
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: create a network
|
- name: create a network
|
||||||
gcp_compute_network:
|
gcp_compute_network:
|
||||||
name: 'network-instancetemplate'
|
name: "network-instancetemplate"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: network
|
register: network
|
||||||
|
|
||||||
- name: create a address
|
- name: create a address
|
||||||
gcp_compute_address:
|
gcp_compute_address:
|
||||||
name: 'address-instancetemplate'
|
name: "address-instancetemplate"
|
||||||
region: 'us-west1'
|
region: us-west1
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: address
|
register: address
|
||||||
|
|
||||||
|
@ -134,37 +131,33 @@ EXAMPLES = '''
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
properties:
|
properties:
|
||||||
disks:
|
disks:
|
||||||
- auto_delete: true
|
- auto_delete: true
|
||||||
boot: true
|
boot: true
|
||||||
initialize_params:
|
initialize_params:
|
||||||
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
network_interfaces:
|
network_interfaces:
|
||||||
- network: "{{ network }}"
|
- network: "{{ network }}"
|
||||||
access_configs:
|
access_configs:
|
||||||
- name: 'test-config'
|
- name: test-config
|
||||||
type: 'ONE_TO_ONE_NAT'
|
type: ONE_TO_ONE_NAT
|
||||||
nat_ip: "{{ address }}"
|
nat_ip: "{{ address }}"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: instancetemplate
|
register: instancetemplate
|
||||||
|
|
||||||
- name: create a instance group manager
|
- name: create a instance group manager
|
||||||
gcp_compute_instance_group_manager:
|
gcp_compute_instance_group_manager:
|
||||||
name: testObject
|
name: "test_object"
|
||||||
base_instance_name: 'test1-child'
|
base_instance_name: test1-child
|
||||||
instance_template: "{{ instancetemplate }}"
|
instance_template: "{{ instancetemplate }}"
|
||||||
target_size: 3
|
target_size: 3
|
||||||
zone: 'us-west1-a'
|
zone: us-west1-a
|
||||||
project: testProject
|
project: "test_project"
|
||||||
auth_kind: service_account
|
auth_kind: "service_account"
|
||||||
service_account_file: /tmp/auth.pem
|
service_account_file: "/tmp/auth.pem"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -258,12 +251,13 @@ RETURN = '''
|
||||||
type: int
|
type: int
|
||||||
instance_group:
|
instance_group:
|
||||||
description:
|
description:
|
||||||
- A reference to InstanceGroup resource.
|
- The instance group being managed.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: dict
|
||||||
instance_template:
|
instance_template:
|
||||||
description:
|
description:
|
||||||
- A reference to InstanceTemplate resource.
|
- The instance template that is specified for this managed instance group. The group
|
||||||
|
uses this template to create all new instances in the managed instance group.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: dict
|
||||||
name:
|
name:
|
||||||
|
@ -292,7 +286,7 @@ RETURN = '''
|
||||||
type: int
|
type: int
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- A reference to Region resource.
|
- The region this managed instance group resides (for regional resources).
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
target_pools:
|
target_pools:
|
||||||
|
@ -310,7 +304,7 @@ RETURN = '''
|
||||||
type: int
|
type: int
|
||||||
zone:
|
zone:
|
||||||
description:
|
description:
|
||||||
- A reference to Zone resource.
|
- The zone the managed instance group resides.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
|
@ -349,6 +343,9 @@ def main():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not module.params['scopes']:
|
||||||
|
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
kind = 'compute#instanceGroupManager'
|
kind = 'compute#instanceGroupManager'
|
||||||
|
|
||||||
|
@ -398,7 +395,7 @@ def resource_to_request(module):
|
||||||
u'description': module.params.get('description'),
|
u'description': module.params.get('description'),
|
||||||
u'instanceTemplate': replace_resource_dict(module.params.get(u'instance_template', {}), 'selfLink'),
|
u'instanceTemplate': replace_resource_dict(module.params.get(u'instance_template', {}), 'selfLink'),
|
||||||
u'name': module.params.get('name'),
|
u'name': module.params.get('name'),
|
||||||
u'namedPorts': InstGrouManaNamePortArray(module.params.get('named_ports', []), module).to_request(),
|
u'namedPorts': InstanceGroupManagerNamedPortsArray(module.params.get('named_ports', []), module).to_request(),
|
||||||
u'targetPools': replace_resource_dict(module.params.get('target_pools', []), 'selfLink'),
|
u'targetPools': replace_resource_dict(module.params.get('target_pools', []), 'selfLink'),
|
||||||
u'targetSize': module.params.get('target_size')
|
u'targetSize': module.params.get('target_size')
|
||||||
}
|
}
|
||||||
|
@ -470,13 +467,13 @@ def response_to_hash(module, response):
|
||||||
return {
|
return {
|
||||||
u'baseInstanceName': response.get(u'baseInstanceName'),
|
u'baseInstanceName': response.get(u'baseInstanceName'),
|
||||||
u'creationTimestamp': response.get(u'creationTimestamp'),
|
u'creationTimestamp': response.get(u'creationTimestamp'),
|
||||||
u'currentActions': InstGrouManaCurrActi(response.get(u'currentActions', {}), module).from_response(),
|
u'currentActions': InstanceGroupManagerCurrentActions(response.get(u'currentActions', {}), module).from_response(),
|
||||||
u'description': module.params.get('description'),
|
u'description': module.params.get('description'),
|
||||||
u'id': response.get(u'id'),
|
u'id': response.get(u'id'),
|
||||||
u'instanceGroup': response.get(u'instanceGroup'),
|
u'instanceGroup': response.get(u'instanceGroup'),
|
||||||
u'instanceTemplate': response.get(u'instanceTemplate'),
|
u'instanceTemplate': response.get(u'instanceTemplate'),
|
||||||
u'name': response.get(u'name'),
|
u'name': response.get(u'name'),
|
||||||
u'namedPorts': InstGrouManaNamePortArray(response.get(u'namedPorts', []), module).from_response(),
|
u'namedPorts': InstanceGroupManagerNamedPortsArray(response.get(u'namedPorts', []), module).from_response(),
|
||||||
u'region': response.get(u'region'),
|
u'region': response.get(u'region'),
|
||||||
u'targetPools': response.get(u'targetPools'),
|
u'targetPools': response.get(u'targetPools'),
|
||||||
u'targetSize': response.get(u'targetSize')
|
u'targetSize': response.get(u'targetSize')
|
||||||
|
@ -504,7 +501,7 @@ def async_op_url(module, extra_data=None):
|
||||||
def wait_for_operation(module, response):
|
def wait_for_operation(module, response):
|
||||||
op_result = return_if_object(module, response, 'compute#operation')
|
op_result = return_if_object(module, response, 'compute#operation')
|
||||||
if op_result is None:
|
if op_result is None:
|
||||||
return None
|
return {}
|
||||||
status = navigate_hash(op_result, ['status'])
|
status = navigate_hash(op_result, ['status'])
|
||||||
wait_done = wait_for_completion(status, op_result, module)
|
wait_done = wait_for_completion(status, op_result, module)
|
||||||
return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#instanceGroupManager')
|
return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#instanceGroupManager')
|
||||||
|
@ -529,7 +526,7 @@ def raise_if_errors(response, err_path, module):
|
||||||
module.fail_json(msg=errors)
|
module.fail_json(msg=errors)
|
||||||
|
|
||||||
|
|
||||||
class InstGrouManaCurrActi(object):
|
class InstanceGroupManagerCurrentActions(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
@ -562,7 +559,7 @@ class InstGrouManaCurrActi(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
class InstGrouManaNamePortArray(object):
|
class InstanceGroupManagerNamedPortsArray(object):
|
||||||
def __init__(self, request, module):
|
def __init__(self, request, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
if request:
|
if request:
|
||||||
|
|
|
@ -15,23 +15,19 @@
|
||||||
# Pre-test setup
|
# Pre-test setup
|
||||||
- name: create a network
|
- name: create a network
|
||||||
gcp_compute_network:
|
gcp_compute_network:
|
||||||
name: 'network-instancetemplate'
|
name: "network-instancetemplate"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: network
|
register: network
|
||||||
- name: create a address
|
- name: create a address
|
||||||
gcp_compute_address:
|
gcp_compute_address:
|
||||||
name: 'address-instancetemplate'
|
name: "address-instancetemplate"
|
||||||
region: 'us-west1'
|
region: us-west1
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: address
|
register: address
|
||||||
- name: create a instance template
|
- name: create a instance template
|
||||||
|
@ -39,50 +35,44 @@
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
properties:
|
properties:
|
||||||
disks:
|
disks:
|
||||||
- auto_delete: true
|
- auto_delete: true
|
||||||
boot: true
|
boot: true
|
||||||
initialize_params:
|
initialize_params:
|
||||||
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
network_interfaces:
|
network_interfaces:
|
||||||
- network: "{{ network }}"
|
- network: "{{ network }}"
|
||||||
access_configs:
|
access_configs:
|
||||||
- name: 'test-config'
|
- name: test-config
|
||||||
type: 'ONE_TO_ONE_NAT'
|
type: ONE_TO_ONE_NAT
|
||||||
nat_ip: "{{ address }}"
|
nat_ip: "{{ address }}"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: instancetemplate
|
register: instancetemplate
|
||||||
- name: delete a instance group manager
|
- name: delete a instance group manager
|
||||||
gcp_compute_instance_group_manager:
|
gcp_compute_instance_group_manager:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
base_instance_name: 'test1-child'
|
base_instance_name: test1-child
|
||||||
instance_template: "{{ instancetemplate }}"
|
instance_template: "{{ instancetemplate }}"
|
||||||
target_size: 3
|
target_size: 3
|
||||||
zone: 'us-west1-a'
|
zone: us-west1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
- name: create a instance group manager
|
- name: create a instance group manager
|
||||||
gcp_compute_instance_group_manager:
|
gcp_compute_instance_group_manager:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
base_instance_name: 'test1-child'
|
base_instance_name: test1-child
|
||||||
instance_template: "{{ instancetemplate }}"
|
instance_template: "{{ instancetemplate }}"
|
||||||
target_size: 3
|
target_size: 3
|
||||||
zone: 'us-west1-a'
|
zone: us-west1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
|
@ -91,26 +81,31 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- "result.kind == 'compute#instanceGroupManager'"
|
- "result.kind == 'compute#instanceGroupManager'"
|
||||||
- name: verify that instance_group_manager was created
|
- name: verify that instance_group_manager was created
|
||||||
shell: |
|
gcp_compute_instance_group_manager_facts:
|
||||||
gcloud compute instance-groups managed describe --zone=us-west1-a --project="{{ gcp_project}}" "{{ resource_name }}"
|
filters:
|
||||||
register: results
|
- name = {{ resource_name }}
|
||||||
- name: verify that command succeeded
|
zone: us-west1-a
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results.rc == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance group manager that already exists
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: 'test1-child'
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: 'us-west1-a'
|
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
scopes:
|
||||||
- https://www.googleapis.com/auth/compute
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['items'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance group manager that already exists
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
|
@ -122,15 +117,13 @@
|
||||||
- name: delete a instance group manager
|
- name: delete a instance group manager
|
||||||
gcp_compute_instance_group_manager:
|
gcp_compute_instance_group_manager:
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
base_instance_name: 'test1-child'
|
base_instance_name: test1-child
|
||||||
instance_template: "{{ instancetemplate }}"
|
instance_template: "{{ instancetemplate }}"
|
||||||
target_size: 3
|
target_size: 3
|
||||||
zone: 'us-west1-a'
|
zone: us-west1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is true
|
- name: assert changed is true
|
||||||
|
@ -139,28 +132,31 @@
|
||||||
- result.changed == true
|
- result.changed == true
|
||||||
- result.has_key('kind') == False
|
- result.has_key('kind') == False
|
||||||
- name: verify that instance_group_manager was deleted
|
- name: verify that instance_group_manager was deleted
|
||||||
shell: |
|
gcp_compute_instance_group_manager_facts:
|
||||||
gcloud compute instance-groups managed describe --zone=us-west1-a --project="{{ gcp_project}}" "{{ resource_name }}"
|
filters:
|
||||||
register: results
|
- name = {{ resource_name }}
|
||||||
failed_when: results.rc == 0
|
zone: us-west1-a
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results.rc == 1
|
|
||||||
- "\"'projects/{{ gcp_project }}/zones/us-west1-a/instanceGroupManagers/{{ resource_name }}' was not found\" in results.stderr"
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance group manager that does not exist
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: 'test1-child'
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: 'us-west1-a'
|
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
scopes:
|
||||||
- https://www.googleapis.com/auth/compute
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['items'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance group manager that does not exist
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
- name: assert changed is false
|
- name: assert changed is false
|
||||||
|
@ -175,42 +171,36 @@
|
||||||
name: "{{ resource_name }}"
|
name: "{{ resource_name }}"
|
||||||
properties:
|
properties:
|
||||||
disks:
|
disks:
|
||||||
- auto_delete: true
|
- auto_delete: true
|
||||||
boot: true
|
boot: true
|
||||||
initialize_params:
|
initialize_params:
|
||||||
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
machine_type: n1-standard-1
|
machine_type: n1-standard-1
|
||||||
network_interfaces:
|
network_interfaces:
|
||||||
- network: "{{ network }}"
|
- network: "{{ network }}"
|
||||||
access_configs:
|
access_configs:
|
||||||
- name: 'test-config'
|
- name: test-config
|
||||||
type: 'ONE_TO_ONE_NAT'
|
type: ONE_TO_ONE_NAT
|
||||||
nat_ip: "{{ address }}"
|
nat_ip: "{{ address }}"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: instancetemplate
|
register: instancetemplate
|
||||||
- name: delete a address
|
- name: delete a address
|
||||||
gcp_compute_address:
|
gcp_compute_address:
|
||||||
name: 'address-instancetemplate'
|
name: "address-instancetemplate"
|
||||||
region: 'us-west1'
|
region: us-west1
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: address
|
register: address
|
||||||
- name: delete a network
|
- name: delete a network
|
||||||
gcp_compute_network:
|
gcp_compute_network:
|
||||||
name: 'network-instancetemplate'
|
name: "network-instancetemplate"
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
state: absent
|
state: absent
|
||||||
register: network
|
register: network
|
||||||
|
|
Loading…
Reference in a new issue