remove min_version from a bunch of fields that are in GA now

This commit is contained in:
Dana Hoffman 2018-10-04 03:11:37 +00:00 committed by Alex Stephen
parent 91dcd0d6f5
commit f1a96adf23
111 changed files with 3604 additions and 3448 deletions

View file

@ -62,6 +62,14 @@ options:
letter, and all following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash.
required: true
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
required: false
version_added: 2.8
choices: ['PREMIUM', 'STANDARD']
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,
@ -135,6 +143,13 @@ RETURN = '''
except the last character, which cannot be a dash.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,
@ -237,7 +252,7 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'name': module.params.get('name'),
u'networkTier': module.params.get('network_tier'),
u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'),
u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink')
}
return_vals = {}
for k, v in request.items():

View file

@ -107,6 +107,13 @@ items:
except the last character, which cannot be a dash.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
subnetwork:
description:
- The URL of the subnetwork in which to reserve the address. If an IP address is specified,

View file

@ -123,6 +123,15 @@ options:
required: false
version_added: 2.8
choices: ['INGRESS', 'EGRESS']
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
required: false
type: bool
version_added: 2.8
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
@ -417,6 +426,14 @@ RETURN = '''
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
returned: success
type: bool
id:
description:
- The unique identifier for the resource.
@ -537,6 +554,7 @@ def main():
description=dict(type='str'),
destination_ranges=dict(type='list', elements='str'),
direction=dict(type='str', choices=['INGRESS', 'EGRESS']),
disabled=dict(type='bool'),
name=dict(required=True, type='str'),
network=dict(required=True, type='dict'),
priority=dict(default=1000, type='int'),
@ -602,6 +620,7 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'destinationRanges': module.params.get('destination_ranges'),
u'direction': module.params.get('direction'),
u'disabled': module.params.get('disabled'),
u'name': module.params.get('name'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'priority': module.params.get('priority'),
@ -682,6 +701,7 @@ def response_to_hash(module, response):
u'description': response.get(u'description'),
u'destinationRanges': response.get(u'destinationRanges'),
u'direction': response.get(u'direction'),
u'disabled': response.get(u'disabled'),
u'id': response.get(u'id'),
u'name': module.params.get('name'),
u'network': response.get(u'network'),

View file

@ -133,6 +133,14 @@ items:
traffic, it is NOT supported to specify sourceRanges OR sourceTags.'
returned: success
type: str
disabled:
description:
- Denotes whether the firewall rule is disabled, i.e not applied to the network it
is associated with. When set to true, the firewall rule is not enforced and the
network behaves as if it did not exist. If this is unspecified, the firewall rule
will be enabled.
returned: success
type: bool
id:
description:
- The unique identifier for the resource.

View file

@ -172,6 +172,14 @@ options:
selfLink of your TargetPool.'
required: false
version_added: 2.7
network_tier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
required: false
version_added: 2.8
choices: ['PREMIUM', 'STANDARD']
region:
description:
- A reference to the region where the regional forwarding rule resides.
@ -352,6 +360,13 @@ RETURN = '''
updates.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.
@ -391,10 +406,8 @@ def main():
ports=dict(type='list', elements='str'),
subnetwork=dict(type='dict'),
target=dict(type='dict'),
all_ports=dict(type='bool'),
network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']),
service_label=dict(type='str'),
region=dict(required=True, type='str'),
region=dict(required=True, type='str')
)
)
@ -491,9 +504,7 @@ def resource_to_request(module):
u'ports': module.params.get('ports'),
u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'),
u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'),
u'allPorts': module.params.get('all_ports'),
u'networkTier': module.params.get('network_tier'),
u'serviceLabel': module.params.get('service_label'),
u'networkTier': module.params.get('network_tier')
}
return_vals = {}
for k, v in request.items():
@ -573,7 +584,8 @@ def response_to_hash(module, response):
u'ports': response.get(u'ports'),
u'subnetwork': response.get(u'subnetwork'),
u'target': response.get(u'target'),
u'labelFingerprint': response.get(u'labelFingerprint')
u'labelFingerprint': response.get(u'labelFingerprint'),
u'networkTier': module.params.get('network_tier')
}

View file

@ -203,6 +203,13 @@ items:
updates.
returned: success
type: str
networkTier:
description:
- 'The networking tier used for configuring this address. This field can take the
following values: PREMIUM or STANDARD. If this field is not specified, it is assumed
to be PREMIUM.'
returned: success
type: str
region:
description:
- A reference to the region where the regional forwarding rule resides.

View file

@ -43,48 +43,34 @@ requirements:
options:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
address:
description:
- The static external IP address represented by this resource.
required: false
version_added: 2.8
description:
description:
- An optional description of this resource.
required: false
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
name must be 1-63 characters long, and comply with RFC1035. Specifically, the
name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
required: true
ip_version:
description:
- The IP Version that will be used by this address. Valid options are `IPV4` or
`IPV6`. The default value is `IPV4`.
required: false
choices:
- IPV4
- IPV6
address_type:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
required: false
default: EXTERNAL
version_added: 2.8
choices:
- EXTERNAL
- INTERNAL
description:
- An optional description of this resource.
- Provide this property when you create the resource.
required: false
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
required: true
ip_version:
description:
- The IP Version that will be used by this address. Valid options are IPV4 or IPV6.
The default value is IPV4.
required: false
choices: ['IPV4', 'IPV6']
address_type:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
required: false
default: EXTERNAL
version_added: 2.8
choices: ['EXTERNAL', 'INTERNAL']
extends_documentation_fragment: gcp
notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/globalAddresses)'
@ -150,6 +136,13 @@ RETURN = '''
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
'''
################################################################################
@ -176,7 +169,7 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
address_type=dict(default='EXTERNAL', type='str', choices=['EXTERNAL', 'INTERNAL']),
address_type=dict(default='EXTERNAL', type='str', choices=['EXTERNAL', 'INTERNAL'])
)
)
@ -251,7 +244,7 @@ def resource_to_request(module):
u'description': module.params.get('description'),
u'name': module.params.get('name'),
u'ipVersion': module.params.get('ip_version'),
u'addressType': module.params.get('address_type'),
u'addressType': module.params.get('address_type')
}
return_vals = {}
for k, v in request.items():
@ -325,7 +318,7 @@ def response_to_hash(module, response):
u'labelFingerprint': response.get(u'labelFingerprint'),
u'ipVersion': response.get(u'ipVersion'),
u'region': response.get(u'region'),
u'addressType': response.get(u'addressType'),
u'addressType': response.get(u'addressType')
}

View file

@ -112,6 +112,13 @@ items:
- A reference to the region where the regional address resides.
returned: success
type: str
addressType:
description:
- The type of the address to reserve, default is EXTERNAL.
- "* EXTERNAL indicates public/external single IP address."
- "* INTERNAL indicates internal IP ranges belonging to some network."
returned: success
type: str
'''
################################################################################

View file

@ -18,311 +18,305 @@
# ----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ["preview"],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_compute_region_disk
description:
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
- Persistent disks are durable storage devices that function similarly to the physical
disks in a desktop or a server. Compute Engine manages the hardware behind these
devices to ensure data redundancy and optimize performance for you. Persistent disks
are available as either standard hard disk drives (HDD) or solid-state drives (SSD).
- Persistent disks are located independently from your virtual machine instances,
so you can detach or move persistent disks to keep your data even after you delete
your instances. Persistent disk performance scales automatically with size, so you
can resize your existing persistent disks or add more persistent disks to an instance
to meet your performance and storage space requirements.
- Add a persistent disk to your instance when you need reliable and affordable storage
with consistent performance characteristics.
short_description: Creates a GCP RegionDisk
version_added: 2.8
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
options:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
required: false
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
required: false
licenses:
description:
- Any applicable publicly visible licenses.
required: false
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
name must be 1-63 characters long, and comply with RFC1035. Specifically, the
name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
required: true
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
required: false
physical_block_size_bytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a request,
a default value is used. Currently supported sizes are 4096 and 16384, other
sizes may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
required: false
replica_zones:
description:
- URLs of the zones where the disk should be replicated to.
required: true
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
required: false
region:
description:
- A reference to the region where the disk resides.
required: true
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
required: false
suboptions:
raw_key:
state:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
required: false
source_snapshot:
- Whether the given object should exist in GCP
choices: ['present', 'absent']
default: 'present'
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''selfLink'' and value
of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
to a gcp_compute_snapshot task and then set this source_snapshot field to "{{
name-of-resource }}"'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
- An optional description of this resource. Provide this property when you create
the resource.
required: false
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
required: false
licenses:
description:
- Any applicable publicly visible licenses.
required: false
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
required: true
size_gb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
required: false
replica_zones:
description:
- URLs of the zones where the disk should be replicated to.
required: true
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
required: false
region:
description:
- A reference to the region where the disk resides.
required: true
disk_encryption_key:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
source_snapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
- 'This field represents a link to a Snapshot resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_snapshot
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively,
you can set this source_snapshot to a dictionary with the selfLink key where the
value is the selfLink of your Snapshot.'
required: false
source_snapshot_encryption_key:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
required: false
suboptions:
raw_key:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
required: false
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
required: false
extends_documentation_fragment: gcp
notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)'
- 'Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)'
- "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/beta/regionDisks)"
- "Adding or Resizing Regional Persistent Disks: U(https://cloud.google.com/compute/docs/disks/regional-persistent-disk)"
'''
EXAMPLES = '''
- name: create a region disk
gcp_compute_region_disk:
name: test_object
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
name: "test_object"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- us-central1-a
- us-central1-f
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
name:
description:
- Name of the resource. Provided by the client when the resource is created. The
name must be 1-63 characters long, and comply with RFC1035. Specifically, the
name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
returned: success
type: str
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of the
snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
physicalBlockSizeBytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a request,
a default value is used. Currently supported sizes are 4096 and 16384, other sizes
may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
returned: success
type: int
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the
disk. Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or
to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need to
provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted and
recreated under the same name, the source snapshot ID would identify the exact
version of the snapshot that was used.
returned: success
type: str
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
returned: success
type: str
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial or
full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -350,13 +344,18 @@ def main():
licenses=dict(type='list', elements='str'),
name=dict(required=True, type='str'),
size_gb=dict(type='int'),
physical_block_size_bytes=dict(type='int'),
replica_zones=dict(required=True, type='list', elements='str'),
type=dict(type='str'),
region=dict(required=True, type='str'),
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
disk_encryption_key=dict(type='dict', options=dict(
raw_key=dict(type='str'),
sha256=dict(type='str')
)),
source_snapshot=dict(type='dict'),
source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
source_snapshot_encryption_key=dict(type='dict', options=dict(
raw_key=dict(type='str'),
sha256=dict(type='str')
))
)
)
@ -397,7 +396,8 @@ def create(module, link, kind):
def update(module, link, kind, fetch):
update_fields(module, resource_to_request(module), response_to_hash(module, fetch))
update_fields(module, resource_to_request(module),
response_to_hash(module, fetch))
return fetch_resource(module, self_link(module), kind)
@ -411,16 +411,27 @@ def update_fields(module, request, response):
def label_fingerprint_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/setLabels"]).format(**module.params),
{u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')},
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/regions/{region}/disks/{name}/setLabels"
]).format(**module.params),
{
u'labelFingerprint': response.get('labelFingerprint'),
u'labels': module.params.get('labels')
}
)
def size_gb_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/disks/{name}/resize"]).format(**module.params),
{u'sizeGb': module.params.get('size_gb')},
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/regions/{region}/disks/{name}/resize"
]).format(**module.params),
{
u'sizeGb': module.params.get('size_gb')
}
)
@ -432,20 +443,19 @@ def delete(module, link, kind):
def resource_to_request(module):
request = {
u'kind': 'compute#disk',
u'diskEncryptionKey': RegionDiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': RegionDiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'diskEncryptionKey': RegionDiskDiskEncryptionKey(module.params.get('disk_encryption_key', {}), module).to_request(),
u'sourceSnapshotEncryptionKey': RegionDiskSourceSnapshotEncryptionKey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
u'description': module.params.get('description'),
u'labels': module.params.get('labels'),
u'licenses': module.params.get('licenses'),
u'name': module.params.get('name'),
u'sizeGb': module.params.get('size_gb'),
u'physicalBlockSizeBytes': module.params.get('physical_block_size_bytes'),
u'replicaZones': module.params.get('replica_zones'),
u'type': region_disk_type_selflink(module.params.get('type'), module.params),
u'type': region_disk_type_selflink(module.params.get('type'), module.params)
}
return_vals = {}
for k, v in request.items():
if v or v is False:
if v:
return_vals[k] = v
return return_vals
@ -476,8 +486,8 @@ def return_if_object(module, response, kind, allow_not_found=False):
try:
module.raise_for_status(response)
result = response.json()
except getattr(json.decoder, 'JSONDecodeError', ValueError):
module.fail_json(msg="Invalid JSON response with error: %s" % response.text)
except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst:
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
@ -518,9 +528,8 @@ def response_to_hash(module, response):
u'name': module.params.get('name'),
u'sizeGb': response.get(u'sizeGb'),
u'users': response.get(u'users'),
u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'),
u'replicaZones': response.get(u'replicaZones'),
u'type': response.get(u'type'),
u'type': response.get(u'type')
}
@ -564,9 +573,11 @@ def wait_for_completion(status, op_result, module):
op_id = navigate_hash(op_result, ['name'])
op_uri = async_op_url(module, {'op_id': op_id})
while status != 'DONE':
raise_if_errors(op_result, ['error', 'errors'], module)
raise_if_errors(op_result, ['error', 'errors'], 'message')
time.sleep(1.0)
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
if status not in ['PENDING', 'RUNNING', 'DONE']:
module.fail_json(msg="Invalid result %s" % status)
op_result = fetch_resource(module, op_uri, 'compute#operation')
status = navigate_hash(op_result, ['status'])
return op_result
@ -577,7 +588,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class RegionDiskDiskencryptionkey(object):
class RegionDiskDiskEncryptionKey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -586,13 +597,19 @@ class RegionDiskDiskencryptionkey(object):
self.request = {}
def to_request(self):
return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')})
return remove_nones_from_dict({
u'rawKey': self.request.get('raw_key'),
u'sha256': self.request.get('sha256')
})
def from_response(self):
return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')})
return remove_nones_from_dict({
u'rawKey': self.request.get(u'rawKey'),
u'sha256': self.request.get(u'sha256')
})
class RegionDiskSourcesnapshotencryptionkey(object):
class RegionDiskSourceSnapshotEncryptionKey(object):
def __init__(self, request, module):
self.module = module
if request:
@ -601,10 +618,16 @@ class RegionDiskSourcesnapshotencryptionkey(object):
self.request = {}
def to_request(self):
return remove_nones_from_dict({u'rawKey': self.request.get('raw_key')})
return remove_nones_from_dict({
u'rawKey': self.request.get('raw_key'),
u'sha256': self.request.get('sha256')
})
def from_response(self):
return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey')})
return remove_nones_from_dict({
u'rawKey': self.request.get(u'rawKey'),
u'sha256': self.request.get(u'sha256')
})
if __name__ == '__main__':

View file

@ -18,211 +18,203 @@
# ----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ["preview"],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_compute_region_disk_facts
description:
- Gather facts for GCP RegionDisk
- Gather facts for GCP RegionDisk
short_description: Gather facts for GCP RegionDisk
version_added: 2.8
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
options:
filters:
description:
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
- Each additional filter in the list will act be added as an AND condition (filter1
and filter2) .
region:
description:
- A reference to the region where the disk resides.
required: true
filters:
description:
A list of filter value pairs. Available filters are listed here
U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).
Each additional filter in the list will act be added as an AND condition
(filter1 and filter2)
region:
description:
- A reference to the region where the disk resides.
required: true
extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: " a region disk facts"
- name: a region disk facts
gcp_compute_region_disk_facts:
region: us-central1
filters:
- name = test_object
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: facts
region: us-central1
filters:
- name = test_object
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
'''
RETURN = '''
resources:
description: List of resources
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
name:
description:
- Name of the resource. Provided by the client when the resource is created.
The name must be 1-63 characters long, and comply with RFC1035. Specifically,
the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last character,
which cannot be a dash.
returned: success
type: str
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when
creating a persistent disk using the sourceImage or sourceSnapshot parameter,
or specify it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value
of sizeGb must not be less than the size of the sourceImage or the size of
the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
physicalBlockSizeBytes:
description:
- Physical block size of the persistent disk, in bytes. If not present in a
request, a default value is used. Currently supported sizes are 4096 and 16384,
other sizes may be added in the future.
- If an unsupported value is requested, the error message will list the supported
values for the caller's project.
returned: success
type: int
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create
the disk. Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the
same key if you use the disk later (e.g. to create a disk snapshot or an image,
or to attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the
disk.
- If you do not provide an encryption key when creating the disk, then the disk
will be encrypted using an automatically generated key and you do not need
to provide a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource.
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the
source snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648
base64 to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies
the exact snapshot that was used to create this persistent disk. For example,
if you created the persistent disk from a snapshot that was later deleted
and recreated under the same name, the source snapshot ID would identify the
exact version of the snapshot that was used.
returned: success
type: str
items:
description: List of items
returned: always
type: complex
contains:
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally during
updates.
returned: success
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
returned: success
type: str
description:
description:
- An optional description of this resource. Provide this property when you create
the resource.
returned: success
type: str
id:
description:
- The unique identifier for the resource.
returned: success
type: int
lastAttachTimestamp:
description:
- Last attach timestamp in RFC3339 text format.
returned: success
type: str
lastDetachTimestamp:
description:
- Last dettach timestamp in RFC3339 text format.
returned: success
type: str
labels:
description:
- Labels to apply to this disk. A list of key->value pairs.
returned: success
type: dict
licenses:
description:
- Any applicable publicly visible licenses.
returned: success
type: list
name:
description:
- Name of the resource. Provided by the client when the resource is created. The name
must be 1-63 characters long, and comply with RFC1035. Specifically, the name must
be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`
which means the first character must be a lowercase letter, and all following characters
must be a dash, lowercase letter, or digit, except the last character, which cannot
be a dash.
returned: success
type: str
sizeGb:
description:
- Size of the persistent disk, specified in GB. You can specify this field when creating
a persistent disk using the sourceImage or sourceSnapshot parameter, or specify
it alone to create an empty persistent disk.
- If you specify this field along with sourceImage or sourceSnapshot, the value of
sizeGb must not be less than the size of the sourceImage or the size of the snapshot.
returned: success
type: int
users:
description:
- 'Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance
.'
returned: success
type: list
replicaZones:
description:
- URLs of the zones where the disk should be replicated to.
returned: success
type: list
type:
description:
- URL of the disk type resource describing which disk type to use to create the disk.
Provide this when creating the disk.
returned: success
type: str
region:
description:
- A reference to the region where the disk resides.
returned: success
type: str
diskEncryptionKey:
description:
- Encrypts the disk using a customer-supplied encryption key.
- After you encrypt a disk with a customer-supplied key, you must provide the same
key if you use the disk later (e.g. to create a disk snapshot or an image, or to
attach the disk to a virtual machine).
- Customer-supplied encryption keys do not protect access to metadata of the disk.
- If you do not provide an encryption key when creating the disk, then the disk will
be encrypted using an automatically generated key and you do not need to provide
a key to use the disk later.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshot:
description:
- 'The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. For example, the following are valid values: *
`U(https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`)
* `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` .'
returned: success
type: dict
sourceSnapshotEncryptionKey:
description:
- The customer-supplied encryption key of the source snapshot. Required if the source
snapshot is protected by a customer-supplied encryption key.
returned: success
type: complex
contains:
rawKey:
description:
- Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64
to either encrypt or decrypt this resource.
returned: success
type: str
sha256:
description:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key
that protects this resource.
returned: success
type: str
sourceSnapshotId:
description:
- The unique ID of the snapshot used to create this disk. This value identifies the
exact snapshot that was used to create this persistent disk. For example, if you
created the persistent disk from a snapshot that was later deleted and recreated
under the same name, the source snapshot ID would identify the exact version of
the snapshot that was used.
returned: success
type: str
'''
################################################################################
@ -237,9 +229,14 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(
argument_spec=dict(
filters=dict(type='list', elements='str'),
region=dict(required=True, type='str')
)
)
if not module.params['scopes']:
if 'scopes' not in module.params:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']
items = fetch_list(module, collection(module), query_options(module.params['filters']))
@ -247,7 +244,9 @@ def main():
items = items.get('items')
else:
items = []
return_value = {'resources': items}
return_value = {
'items': items
}
module.exit_json(**return_value)

View file

@ -139,7 +139,34 @@ options:
set this network to a dictionary with the selfLink key where the value is the selfLink
of your Network.'
required: true
ip_cidr_range:
enable_flow_logs:
description:
- Whether to enable flow logging for this subnetwork.
required: false
type: bool
version_added: 2.8
secondary_ip_ranges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
required: false
version_added: 2.8
suboptions:
range_name:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
required: true
ip_cidr_range:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
required: true
private_ip_google_access:
description:
- The range of IP addresses belonging to this subnetwork secondary range.
Provide this property when you create the subnetwork.
@ -233,6 +260,40 @@ RETURN = '''
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned external
@ -270,9 +331,10 @@ def main():
name=dict(required=True, type='str'),
network=dict(required=True, type='dict'),
enable_flow_logs=dict(type='bool'),
secondary_ip_ranges=dict(
type='list', elements='dict', options=dict(range_name=dict(required=True, type='str'), ip_cidr_range=dict(required=True, type='str'))
),
secondary_ip_ranges=dict(type='list', elements='dict', options=dict(
range_name=dict(required=True, type='str'),
ip_cidr_range=dict(required=True, type='str')
)),
private_ip_google_access=dict(type='bool'),
region=dict(required=True, type='str'),
)
@ -323,6 +385,8 @@ def update(module, link, kind, fetch):
def update_fields(module, request, response):
if response.get('ipCidrRange') != request.get('ipCidrRange'):
ip_cidr_range_update(module, request, response)
if response.get('enableFlowLogs') != request.get('enableFlowLogs') or response.get('secondaryIpRanges') != request.get('secondaryIpRanges'):
enable_flow_logs_update(module, request, response)
if response.get('privateIpGoogleAccess') != request.get('privateIpGoogleAccess'):
private_ip_google_access_update(module, request, response)
@ -340,6 +404,21 @@ def ip_cidr_range_update(module, request, response):
)
def enable_flow_logs_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.patch(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/regions/{region}/subnetworks/{name}"
]).format(**module.params),
{
u'enableFlowLogs': module.params.get('enable_flow_logs'),
u'fingerprint': response.get('fingerprint'),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request()
}
)
def private_ip_google_access_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
@ -366,7 +445,7 @@ def resource_to_request(module):
u'name': module.params.get('name'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'enableFlowLogs': module.params.get('enable_flow_logs'),
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(module.params.get('secondary_ip_ranges', []), module).to_request(),
u'privateIpGoogleAccess': module.params.get('private_ip_google_access'),
u'region': module.params.get('region'),
}
@ -443,7 +522,7 @@ def response_to_hash(module, response):
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'enableFlowLogs': response.get(u'enableFlowLogs'),
u'fingerprint': response.get(u'fingerprint'),
u'secondaryIpRanges': SubnetworkSecondaryiprangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
u'secondaryIpRanges': SubnetworkSecondaryIpRangesArray(response.get(u'secondaryIpRanges', []), module).from_response(),
u'privateIpGoogleAccess': response.get(u'privateIpGoogleAccess'),
u'region': module.params.get('region'),
}
@ -484,7 +563,7 @@ def raise_if_errors(response, err_path, module):
module.fail_json(msg=errors)
class SubnetworkSecondaryiprangesArray(object):
class SubnetworkSecondaryIpRangesArray(object):
def __init__(self, request, module):
self.module = module
if request:
@ -505,10 +584,16 @@ class SubnetworkSecondaryiprangesArray(object):
return items
def _request_for_item(self, item):
return remove_nones_from_dict({u'rangeName': item.get('range_name'), u'ipCidrRange': item.get('ip_cidr_range')})
return remove_nones_from_dict({
u'rangeName': item.get('range_name'),
u'ipCidrRange': item.get('ip_cidr_range')
})
def _response_from_item(self, item):
return remove_nones_from_dict({u'rangeName': item.get(u'rangeName'), u'ipCidrRange': item.get(u'ipCidrRange')})
return remove_nones_from_dict({
u'rangeName': item.get(u'rangeName'),
u'ipCidrRange': item.get(u'ipCidrRange')
})
if __name__ == '__main__':

View file

@ -115,6 +115,40 @@ items:
- Only networks that are in the distributed mode can have subnetworks.
returned: success
type: dict
enableFlowLogs:
description:
- Whether to enable flow logging for this subnetwork.
returned: success
type: bool
fingerprint:
description:
- Fingerprint of this resource. This field is used internally during updates of this
resource.
returned: success
type: str
secondaryIpRanges:
description:
- An array of configurations for secondary IP ranges for VM instances contained in
this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange
of the subnetwork. The alias IPs may belong to either primary or secondary ranges.
returned: success
type: complex
contains:
rangeName:
description:
- The name associated with this subnetwork secondary range, used when adding an alias
IP range to a VM instance. The name must be 1-63 characters long, and comply with
RFC1035. The name must be unique within the subnetwork.
returned: success
type: str
ipCidrRange:
description:
- The range of IP addresses belonging to this subnetwork secondary range. Provide
this property when you create the subnetwork.
- Ranges must be unique and non-overlapping with all primary and secondary IP ranges
within a network. Only IPv4 is supported.
returned: success
type: str
privateIpGoogleAccess:
description:
- Whether the VMs in this subnet can access Google services without assigned external

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,23 +15,23 @@
# Pre-test setup
- name: delete a dataset
gcp_bigquery_dataset:
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a dataset
gcp_bigquery_dataset:
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -49,17 +49,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length >= 1
- results['resources'] | length >= 1
# ----------------------------------------------------------------------------
- name: create a dataset that already exists
gcp_bigquery_dataset:
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -69,13 +69,13 @@
#----------------------------------------------------------
- name: delete a dataset
gcp_bigquery_dataset:
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -93,17 +93,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a dataset that does not exist
gcp_bigquery_dataset:
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my_example_dataset
dataset_reference:
dataset_id: my_example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,39 +15,39 @@
# Pre-test setup
- name: create a dataset
gcp_bigquery_dataset:
name: example_dataset
dataset_reference:
dataset_id: example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: example_dataset
dataset_reference:
dataset_id: example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: dataset
- name: delete a table
gcp_bigquery_table:
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a table
gcp_bigquery_table:
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -66,20 +66,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length >= 1
- results['resources'] | length >= 1
# ----------------------------------------------------------------------------
- name: create a table that already exists
gcp_bigquery_table:
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -89,16 +89,16 @@
#----------------------------------------------------------
- name: delete a table
gcp_bigquery_table:
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -117,20 +117,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a table that does not exist
gcp_bigquery_table:
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: example_table
dataset: example_dataset
table_reference:
dataset_id: example_dataset
project_id: "{{ gcp_project }}"
table_id: example_table
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -142,12 +142,12 @@
# If errors happen, don't crash the playbook!
- name: delete a dataset
gcp_bigquery_dataset:
name: example_dataset
dataset_reference:
dataset_id: example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: example_dataset
dataset_reference:
dataset_id: example_dataset
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: dataset
ignore_errors: true

View file

@ -1 +1,2 @@
cloud/gcp
unsupported

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,25 +15,21 @@
# Pre-test setup
- name: delete a address
gcp_compute_address:
name: 'test-address1'
region: 'us-west1'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: absent
name: test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a address
gcp_compute_address:
name: 'test-address1'
region: 'us-west1'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: present
name: test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -41,24 +37,29 @@
- result.changed == true
- "result.kind == 'compute#address'"
- name: verify that address was created
shell: |
gcloud compute addresses describe --project="{{ gcp_project}}" --region=us-west1 test-address1
register: results
- name: verify that command succeeded
assert:
that:
- results.rc == 0
# ----------------------------------------------------------------------------
- name: create a address that already exists
gcp_compute_address:
name: 'test-address1'
region: 'us-west1'
gcp_compute_address_facts:
filters:
- name = test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: present
register: results
- name: verify that command succeeded
assert:
that:
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a address that already exists
gcp_compute_address:
name: test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -68,14 +69,12 @@
#----------------------------------------------------------
- name: delete a address
gcp_compute_address:
name: 'test-address1'
region: 'us-west1'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: absent
name: test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -83,26 +82,29 @@
- result.changed == true
- result.has_key('kind') == False
- name: verify that address was deleted
shell: |
gcloud compute addresses describe --project="{{ gcp_project}}" --region=us-west1 test-address1
register: results
failed_when: results.rc == 0
- name: verify that command succeeded
assert:
that:
- results.rc == 1
- "\"'projects/{{ gcp_project }}/regions/us-west1/addresses/test-address1' was not found\" in results.stderr"
# ----------------------------------------------------------------------------
- name: delete a address that does not exist
gcp_compute_address:
name: 'test-address1'
region: 'us-west1'
gcp_compute_address_facts:
filters:
- name = test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: absent
register: results
- name: verify that command succeeded
assert:
that:
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a address that does not exist
gcp_compute_address:
name: test-address1
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,33 +15,33 @@
# Pre-test setup
- name: create a bucket
gcp_storage_bucket:
name: "bucket-backendbucket"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: bucket-backendbucket
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: bucket
- name: delete a backend bucket
gcp_compute_backend_bucket:
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a backend bucket
gcp_compute_backend_bucket:
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -61,18 +61,18 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a backend bucket that already exists
gcp_compute_backend_bucket:
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -82,14 +82,14 @@
#----------------------------------------------------------
- name: delete a backend bucket
gcp_compute_backend_bucket:
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -109,18 +109,18 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a backend bucket that does not exist
gcp_compute_backend_bucket:
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
bucket_name: "{{ bucket.name }}"
description: A BackendBucket to connect LNB w/ Storage Bucket
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -132,10 +132,10 @@
# If errors happen, don't crash the playbook!
- name: delete a bucket
gcp_storage_bucket:
name: "bucket-backendbucket"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: bucket-backendbucket
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: bucket
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,50 +15,50 @@
# Pre-test setup
- name: create a instance group
gcp_compute_instance_group:
name: "instancegroup-backendservice"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instancegroup-backendservice
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancegroup
- name: create a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-backendservice"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: httphealthcheck-backendservice
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: healthcheck
- name: delete a backend service
gcp_compute_backend_service:
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a backend service
gcp_compute_backend_service:
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -78,20 +78,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a backend service that already exists
gcp_compute_backend_service:
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -101,16 +101,16 @@
#----------------------------------------------------------
- name: delete a backend service
gcp_compute_backend_service:
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -130,20 +130,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a backend service that does not exist
gcp_compute_backend_service:
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -155,24 +155,24 @@
# If errors happen, don't crash the playbook!
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-backendservice"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: httphealthcheck-backendservice
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-backendservice"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instancegroup-backendservice
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,27 +15,27 @@
# Pre-test setup
- name: delete a disk
gcp_compute_disk:
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a disk
gcp_compute_disk:
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -56,19 +56,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a disk that already exists
gcp_compute_disk:
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -78,15 +78,15 @@
#----------------------------------------------------------
- name: delete a disk
gcp_compute_disk:
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -107,19 +107,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a disk that does not exist
gcp_compute_disk:
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
size_gb: 50
disk_encryption_key:
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,37 +15,37 @@
# Pre-test setup
- name: delete a firewall
gcp_compute_firewall:
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a firewall
gcp_compute_firewall:
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -65,24 +65,24 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a firewall that already exists
gcp_compute_firewall:
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -92,20 +92,20 @@
#----------------------------------------------------------
- name: delete a firewall
gcp_compute_firewall:
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -125,24 +125,24 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a firewall that does not exist
gcp_compute_firewall:
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
allowed:
- ip_protocol: tcp
ports:
- '22'
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,47 +15,47 @@
# Pre-test setup
- name: create a address
gcp_compute_address:
name: "address-forwardingrule"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: address-forwardingrule
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: address
- name: create a target pool
gcp_compute_target_pool:
name: "targetpool-forwardingrule"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: targetpool-forwardingrule
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: targetpool
- name: delete a forwarding rule
gcp_compute_forwarding_rule:
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a forwarding rule
gcp_compute_forwarding_rule:
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -76,20 +76,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a forwarding rule that already exists
gcp_compute_forwarding_rule:
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -99,16 +99,16 @@
#----------------------------------------------------------
- name: delete a forwarding rule
gcp_compute_forwarding_rule:
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -129,20 +129,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a forwarding rule that does not exist
gcp_compute_forwarding_rule:
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target: "{{ targetpool }}"
ip_protocol: TCP
port_range: 80-80
ip_address: "{{ address.address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -154,21 +154,21 @@
# If errors happen, don't crash the playbook!
- name: delete a target pool
gcp_compute_target_pool:
name: "targetpool-forwardingrule"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: targetpool-forwardingrule
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: targetpool
ignore_errors: true
- name: delete a address
gcp_compute_address:
name: "address-forwardingrule"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: address-forwardingrule
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a global address
gcp_compute_global_address:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a global address
gcp_compute_global_address:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -47,15 +47,15 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a global address that already exists
gcp_compute_global_address:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -65,11 +65,11 @@
#----------------------------------------------------------
- name: delete a global address
gcp_compute_global_address:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -89,15 +89,15 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a global address that does not exist
gcp_compute_global_address:
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,87 +15,87 @@
# Pre-test setup
- name: create a global address
gcp_compute_global_address:
name: "globaladdress-globalforwardingrule"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: globaladdress-globalforwardingrule
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: globaladdress
- name: create a instance group
gcp_compute_instance_group:
name: "instancegroup-globalforwardingrule"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instancegroup-globalforwardingrule
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancegroup
- name: create a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-globalforwardingrule"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: httphealthcheck-globalforwardingrule
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: healthcheck
- name: create a backend service
gcp_compute_backend_service:
name: "backendservice-globalforwardingrule"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: backendservice-globalforwardingrule
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: backendservice
- name: create a url map
gcp_compute_url_map:
name: "urlmap-globalforwardingrule"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: urlmap-globalforwardingrule
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: urlmap
- name: create a target http proxy
gcp_compute_target_http_proxy:
name: "targethttpproxy-globalforwardingrule"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: targethttpproxy-globalforwardingrule
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: httpproxy
- name: delete a global forwarding rule
gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a global forwarding rule
gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -115,19 +115,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a global forwarding rule that already exists
gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -137,15 +137,15 @@
#----------------------------------------------------------
- name: delete a global forwarding rule
gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -165,19 +165,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a global forwarding rule that does not exist
gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -189,67 +189,67 @@
# If errors happen, don't crash the playbook!
- name: delete a target http proxy
gcp_compute_target_http_proxy:
name: "targethttpproxy-globalforwardingrule"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: targethttpproxy-globalforwardingrule
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: httpproxy
ignore_errors: true
- name: delete a url map
gcp_compute_url_map:
name: "urlmap-globalforwardingrule"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: urlmap-globalforwardingrule
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: urlmap
ignore_errors: true
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-globalforwardingrule"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: backendservice-globalforwardingrule
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-globalforwardingrule"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: httphealthcheck-globalforwardingrule
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-globalforwardingrule"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instancegroup-globalforwardingrule
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true
- name: delete a global address
gcp_compute_global_address:
name: "globaladdress-globalforwardingrule"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: globaladdress-globalforwardingrule
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: globaladdress
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,35 +15,35 @@
# Pre-test setup
- name: delete a health check
gcp_compute_health_check:
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a health check
gcp_compute_health_check:
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -63,23 +63,23 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a health check that already exists
gcp_compute_health_check:
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -89,19 +89,19 @@
#----------------------------------------------------------
- name: delete a health check
gcp_compute_health_check:
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -121,23 +121,23 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a health check that does not exist
gcp_compute_health_check:
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,27 +15,27 @@
# Pre-test setup
- name: delete a http health check
gcp_compute_http_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a http health check
gcp_compute_http_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -55,19 +55,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a http health check that already exists
gcp_compute_http_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -77,15 +77,15 @@
#----------------------------------------------------------
- name: delete a http health check
gcp_compute_http_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -105,19 +105,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a http health check that does not exist
gcp_compute_http_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,27 +15,27 @@
# Pre-test setup
- name: delete a https health check
gcp_compute_https_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a https health check
gcp_compute_https_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -55,19 +55,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a https health check that already exists
gcp_compute_https_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -77,15 +77,15 @@
#----------------------------------------------------------
- name: delete a https health check
gcp_compute_https_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -105,19 +105,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a https health check that does not exist
gcp_compute_https_health_check:
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,30 +15,30 @@
# Pre-test setup
- name: create a disk
gcp_compute_disk:
name: "disk-image"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: disk-image
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: disk
- name: delete a image
gcp_compute_image:
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a image
gcp_compute_image:
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -58,16 +58,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a image that already exists
gcp_compute_image:
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -77,12 +77,12 @@
#----------------------------------------------------------
- name: delete a image
gcp_compute_image:
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -102,16 +102,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a image that does not exist
gcp_compute_image:
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
source_disk: "{{ disk }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -123,11 +123,11 @@
# If errors happen, don't crash the playbook!
- name: delete a disk
gcp_compute_disk:
name: "disk-image"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: disk-image
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: disk
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,77 +15,77 @@
# Pre-test setup
- name: create a disk
gcp_compute_disk:
name: "disk-instance"
size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: disk-instance
size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: disk
- name: create a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a address
gcp_compute_address:
name: "address-instance"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: address-instance
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: address
- name: delete a instance
gcp_compute_instance:
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: 'true'
boot: 'true'
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance
gcp_compute_instance:
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: 'true'
boot: 'true'
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -106,30 +106,30 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a instance that already exists
gcp_compute_instance:
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: 'true'
boot: 'true'
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -139,26 +139,26 @@
#----------------------------------------------------------
- name: delete a instance
gcp_compute_instance:
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: 'true'
boot: 'true'
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -179,30 +179,30 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
gcp_compute_instance:
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
machine_type: n1-standard-1
disks:
- auto_delete: 'true'
boot: 'true'
source: "{{ disk }}"
metadata:
startup-script-url: gs:://graphite-playground/bootstrap.sh
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: External NAT
nat_ip: "{{ address }}"
type: ONE_TO_ONE_NAT
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -214,32 +214,32 @@
# If errors happen, don't crash the playbook!
- name: delete a address
gcp_compute_address:
name: "address-instance"
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: address-instance
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true
- name: delete a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true
- name: delete a disk
gcp_compute_disk:
name: "disk-instance"
size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: disk-instance
size_gb: 50
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: disk
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,37 +15,37 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-instancegroup"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instancegroup
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a instance group
gcp_compute_instance_group:
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance group
gcp_compute_instance_group:
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -66,20 +66,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a instance group that already exists
gcp_compute_instance_group:
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -89,16 +89,16 @@
#----------------------------------------------------------
- name: delete a instance group
gcp_compute_instance_group:
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -119,20 +119,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a instance group that does not exist
gcp_compute_instance_group:
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
named_ports:
- name: ansible
port: 1234
network: "{{ network }}"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -144,10 +144,10 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-instancegroup"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instancegroup
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,65 +15,65 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-instancetemplate"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instancetemplate
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a address
gcp_compute_address:
name: "address-instancetemplate"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: address-instancetemplate
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: address
- name: create a instance template
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancetemplate
- name: delete a instance group manager
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
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
#----------------------------------------------------------
- name: create a instance group manager
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
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
register: result
- name: assert changed is true
assert:
@ -94,19 +94,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | 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
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
register: result
- name: assert changed is false
assert:
@ -116,15 +116,15 @@
#----------------------------------------------------------
- name: delete a instance group manager
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
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
register: result
- name: assert changed is true
assert:
@ -145,19 +145,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | 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
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
register: result
- name: assert changed is false
assert:
@ -169,42 +169,42 @@
# If errors happen, don't crash the playbook!
- name: delete a instance template
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancetemplate
ignore_errors: true
- name: delete a address
gcp_compute_address:
name: "address-instancetemplate"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: address-instancetemplate
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true
- name: delete a network
gcp_compute_network:
name: "network-instancetemplate"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instancetemplate
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,62 +15,62 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-instancetemplate"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instancetemplate
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a address
gcp_compute_address:
name: "address-instancetemplate"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: address-instancetemplate
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: address
- name: delete a instance template
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance template
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -90,28 +90,28 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a instance template that already exists
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -121,24 +121,24 @@
#----------------------------------------------------------
- name: delete a instance template
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -158,28 +158,28 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a instance template that does not exist
gcp_compute_instance_template:
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: test-config
type: ONE_TO_ONE_NAT
nat_ip: "{{ address }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -191,20 +191,20 @@
# If errors happen, don't crash the playbook!
- name: delete a address
gcp_compute_address:
name: "address-instancetemplate"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: address-instancetemplate
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true
- name: delete a network
gcp_compute_network:
name: "network-instancetemplate"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instancetemplate
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,21 +15,21 @@
# Pre-test setup
- name: delete a network
gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a network
gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -49,16 +49,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a network that already exists
gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -68,12 +68,12 @@
#----------------------------------------------------------
- name: delete a network
gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -93,16 +93,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a network that does not exist
gcp_compute_network:
name: "{{ resource_name }}"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -21,8 +21,8 @@
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
- us-central1-a
- us-central1-f
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -36,8 +36,8 @@
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
- us-central1-a
- us-central1-f
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -72,8 +72,8 @@
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
- us-central1-a
- us-central1-f
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -93,8 +93,8 @@
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
- us-central1-a
- us-central1-f
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -129,8 +129,8 @@
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
region: us-central1
replica_zones:
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
- us-central1-a
- us-central1-f
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,39 +15,39 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-route"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-route
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a route
gcp_compute_route:
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a route
gcp_compute_route:
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -67,21 +67,21 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a route that already exists
gcp_compute_route:
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -91,17 +91,17 @@
#----------------------------------------------------------
- name: delete a route
gcp_compute_route:
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -121,21 +121,21 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a route that does not exist
gcp_compute_route:
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dest_range: 192.168.6.0/24
next_hop_gateway: global/gateways/default-internet-gateway
network: "{{ network }}"
tags:
- backends
- databases
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -147,10 +147,10 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-route"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-route
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,47 +15,47 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-router"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-router
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a router
gcp_compute_router:
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a router
gcp_compute_router:
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -76,25 +76,25 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a router that already exists
gcp_compute_router:
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -104,21 +104,21 @@
#----------------------------------------------------------
- name: delete a router
gcp_compute_router:
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -139,25 +139,25 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a router that does not exist
gcp_compute_router:
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -169,10 +169,10 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-router"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-router
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,29 +15,29 @@
# Pre-test setup
- name: delete a ssl policy
gcp_compute_ssl_policy:
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a ssl policy
gcp_compute_ssl_policy:
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -57,20 +57,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a ssl policy that already exists
gcp_compute_ssl_policy:
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -80,16 +80,16 @@
#----------------------------------------------------------
- name: delete a ssl policy
gcp_compute_ssl_policy:
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -109,20 +109,20 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a ssl policy that does not exist
gcp_compute_ssl_policy:
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
profile: CUSTOM
min_tls_version: TLS_1_2
custom_features:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,34 +15,34 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-subnetwork"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-subnetwork
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a subnetwork
gcp_compute_subnetwork:
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a subnetwork
gcp_compute_subnetwork:
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -63,18 +63,18 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a subnetwork that already exists
gcp_compute_subnetwork:
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -84,14 +84,14 @@
#----------------------------------------------------------
- name: delete a subnetwork
gcp_compute_subnetwork:
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -112,18 +112,18 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a subnetwork that does not exist
gcp_compute_subnetwork:
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: ansiblenet
region: us-west1
network: "{{ network }}"
ip_cidr_range: 172.16.0.0/16
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -135,11 +135,11 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-subnetwork"
auto_create_subnetworks: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-subnetwork
auto_create_subnetworks: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,64 +15,64 @@
# Pre-test setup
- name: create a instance group
gcp_compute_instance_group:
name: "instancegroup-targethttpproxy"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instancegroup-targethttpproxy
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancegroup
- name: create a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-targethttpproxy"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: httphealthcheck-targethttpproxy
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: healthcheck
- name: create a backend service
gcp_compute_backend_service:
name: "backendservice-targethttpproxy"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: backendservice-targethttpproxy
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: backendservice
- name: create a url map
gcp_compute_url_map:
name: "urlmap-targethttpproxy"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: urlmap-targethttpproxy
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: urlmap
- name: delete a target http proxy
gcp_compute_target_http_proxy:
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a target http proxy
gcp_compute_target_http_proxy:
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -92,16 +92,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a target http proxy that already exists
gcp_compute_target_http_proxy:
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -111,12 +111,12 @@
#----------------------------------------------------------
- name: delete a target http proxy
gcp_compute_target_http_proxy:
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -136,16 +136,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a target http proxy that does not exist
gcp_compute_target_http_proxy:
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -157,48 +157,48 @@
# If errors happen, don't crash the playbook!
- name: delete a url map
gcp_compute_url_map:
name: "urlmap-targethttpproxy"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: urlmap-targethttpproxy
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: urlmap
ignore_errors: true
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-targethttpproxy"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: backendservice-targethttpproxy
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-targethttpproxy"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: httphealthcheck-targethttpproxy
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-targethttpproxy"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instancegroup-targethttpproxy
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,21 +15,21 @@
# Pre-test setup
- name: delete a target pool
gcp_compute_target_pool:
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a target pool
gcp_compute_target_pool:
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -50,16 +50,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a target pool that already exists
gcp_compute_target_pool:
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -69,12 +69,12 @@
#----------------------------------------------------------
- name: delete a target pool
gcp_compute_target_pool:
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -95,16 +95,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a target pool that does not exist
gcp_compute_target_pool:
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,61 +15,61 @@
# Pre-test setup
- name: create a instance group
gcp_compute_instance_group:
name: "instancegroup-targettcpproxy"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instancegroup-targettcpproxy
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancegroup
- name: create a health check
gcp_compute_health_check:
name: "healthcheck-targettcpproxy"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: healthcheck-targettcpproxy
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: healthcheck
- name: create a backend service
gcp_compute_backend_service:
name: "backendservice-targettcpproxy"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
protocol: TCP
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: backendservice-targettcpproxy
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
protocol: TCP
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: backendservice
- name: delete a target tcp proxy
gcp_compute_target_tcp_proxy:
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a target tcp proxy
gcp_compute_target_tcp_proxy:
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -89,17 +89,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a target tcp proxy that already exists
gcp_compute_target_tcp_proxy:
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -109,13 +109,13 @@
#----------------------------------------------------------
- name: delete a target tcp proxy
gcp_compute_target_tcp_proxy:
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -135,17 +135,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a target tcp proxy that does not exist
gcp_compute_target_tcp_proxy:
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
proxy_header: PROXY_V1
service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -157,42 +157,42 @@
# If errors happen, don't crash the playbook!
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-targettcpproxy"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
protocol: TCP
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: backendservice-targettcpproxy
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
protocol: TCP
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a health check
gcp_compute_health_check:
name: "healthcheck-targettcpproxy"
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: healthcheck-targettcpproxy
type: TCP
tcp_health_check:
port_name: service-health
request: ping
response: pong
healthy_threshold: 10
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-targettcpproxy"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instancegroup-targettcpproxy
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,40 +15,40 @@
# Pre-test setup
- name: create a address
gcp_compute_address:
name: "address-vpngateway"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: address-vpngateway
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: address
- name: create a network
gcp_compute_network:
name: "network-vpngateway"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-vpngateway
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -69,17 +69,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a target vpn gateway that already exists
gcp_compute_target_vpn_gateway:
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -89,13 +89,13 @@
#----------------------------------------------------------
- name: delete a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -116,17 +116,17 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a target vpn gateway that does not exist
gcp_compute_target_vpn_gateway:
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -138,20 +138,20 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-vpngateway"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-vpngateway
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true
- name: delete a address
gcp_compute_address:
name: "address-vpngateway"
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: address-vpngateway
region: us-west1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,55 +15,55 @@
# Pre-test setup
- name: create a instance group
gcp_compute_instance_group:
name: "instancegroup-urlmap"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instancegroup-urlmap
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instancegroup
- name: create a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-urlmap"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: httphealthcheck-urlmap
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: healthcheck
- name: create a backend service
gcp_compute_backend_service:
name: "backendservice-urlmap"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: backendservice-urlmap
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: backendservice
- name: delete a url map
gcp_compute_url_map:
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a url map
gcp_compute_url_map:
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -83,16 +83,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a url map that already exists
gcp_compute_url_map:
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -102,12 +102,12 @@
#----------------------------------------------------------
- name: delete a url map
gcp_compute_url_map:
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -127,16 +127,16 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a url map that does not exist
gcp_compute_url_map:
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -148,38 +148,38 @@
# If errors happen, don't crash the playbook!
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-urlmap"
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: true
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: backendservice-urlmap
backends:
- group: "{{ instancegroup }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-urlmap"
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: httphealthcheck-urlmap
healthy_threshold: 10
port: 8080
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-urlmap"
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instancegroup-urlmap
zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,63 +15,63 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-vpn-tunnel"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-vpn-tunnel
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: create a router
gcp_compute_router:
name: "router-vpn-tunnel"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: router-vpn-tunnel
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: router
- name: create a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "gateway-vpn-tunnel"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: gateway-vpn-tunnel
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: gateway
- name: delete a vpn tunnel
gcp_compute_vpn_tunnel:
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a vpn tunnel
gcp_compute_vpn_tunnel:
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -92,19 +92,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 1
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a vpn tunnel that already exists
gcp_compute_vpn_tunnel:
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -114,15 +114,15 @@
#----------------------------------------------------------
- name: delete a vpn tunnel
gcp_compute_vpn_tunnel:
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -143,19 +143,19 @@
- name: verify that command succeeded
assert:
that:
- results['items'] | length == 0
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a vpn tunnel that does not exist
gcp_compute_vpn_tunnel:
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
region: us-west1
target_vpn_gateway: "{{ gateway }}"
router: "{{ router }}"
shared_secret: super secret
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -167,40 +167,40 @@
# If errors happen, don't crash the playbook!
- name: delete a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "gateway-vpn-tunnel"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: gateway-vpn-tunnel
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: gateway
ignore_errors: true
- name: delete a router
gcp_compute_router:
name: "router-vpn-tunnel"
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: router-vpn-tunnel
network: "{{ network }}"
bgp:
asn: 64514
advertise_mode: CUSTOM
advertised_groups:
- ALL_SUBNETS
advertised_ip_ranges:
- range: 1.2.3.4
- range: 6.7.0.0/16
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: router
ignore_errors: true
- name: delete a network
gcp_compute_network:
name: "network-vpn-tunnel"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-vpn-tunnel
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,35 +15,35 @@
# Pre-test setup
- name: delete a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -65,19 +65,19 @@
# ----------------------------------------------------------------------------
- name: create a cluster that already exists
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -86,19 +86,19 @@
#----------------------------------------------------------
- name: delete a cluster
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -120,19 +120,19 @@
# ----------------------------------------------------------------------------
- name: delete a cluster that does not exist
gcp_container_cluster:
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-cluster
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,35 +15,35 @@
# Pre-test setup
- name: create a cluster
gcp_container_cluster:
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: cluster
- name: delete a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -68,14 +68,14 @@
# ----------------------------------------------------------------------------
- name: create a node pool that already exists
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -84,14 +84,14 @@
#----------------------------------------------------------
- name: delete a node pool
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -116,14 +116,14 @@
# ----------------------------------------------------------------------------
- name: delete a node pool that does not exist
gcp_container_node_pool:
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -134,12 +134,12 @@
# If errors happen, don't crash the playbook!
- name: delete a cluster
gcp_container_cluster:
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: cluster
ignore_errors: true

View file

@ -1 +1,2 @@
cloud/gcp
unsupported

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,23 +15,23 @@
# Pre-test setup
- name: delete a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -54,13 +54,13 @@
# ----------------------------------------------------------------------------
- name: create a managed zone that already exists
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -70,13 +70,13 @@
#----------------------------------------------------------
- name: delete a managed zone
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -99,13 +99,13 @@
# ----------------------------------------------------------------------------
- name: delete a managed zone that does not exist
gcp_dns_managed_zone:
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
dns_name: test.somewild2.example.com.
description: test zone
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1 +1,2 @@
cloud/gcp
unsupported

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -1,3 +1,3 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"
sa_name: sa-{{ 100000 | random }}@graphite-playground.google.com.iam.gserviceaccount.com

View file

@ -15,25 +15,21 @@
# Pre-test setup
- name: delete a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -54,14 +50,12 @@
# ----------------------------------------------------------------------------
- name: create a service account that already exists
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -70,14 +64,12 @@
#----------------------------------------------------------
- name: delete a service account
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -98,14 +90,12 @@
# ----------------------------------------------------------------------------
- name: delete a service account that does not exist
gcp_iam_service_account:
name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com"
'
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,31 +15,31 @@
# Pre-test setup
- name: create a topic
gcp_pubsub_topic:
name: "topic-subscription"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: topic-subscription
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: topic
- name: delete a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -60,13 +60,13 @@
# ----------------------------------------------------------------------------
- name: create a subscription that already exists
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -75,13 +75,13 @@
#----------------------------------------------------------
- name: delete a subscription
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -102,13 +102,13 @@
# ----------------------------------------------------------------------------
- name: delete a subscription that does not exist
gcp_pubsub_subscription:
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: "{{ resource_name }}"
topic: "{{ topic }}"
ack_deadline_seconds: 300
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -119,10 +119,10 @@
# If errors happen, don't crash the playbook!
- name: delete a topic
gcp_pubsub_topic:
name: "topic-subscription"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: topic-subscription
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: topic
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -48,11 +48,11 @@
# ----------------------------------------------------------------------------
- name: create a topic that already exists
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -61,11 +61,11 @@
#----------------------------------------------------------
- name: delete a topic
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -86,11 +86,11 @@
# ----------------------------------------------------------------------------
- name: delete a topic that does not exist
gcp_pubsub_topic:
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-topic1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,47 +15,47 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: network
- name: delete a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -77,21 +77,21 @@
# ----------------------------------------------------------------------------
- name: create a instance that already exists
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -100,21 +100,21 @@
#----------------------------------------------------------
- name: delete a instance
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -136,21 +136,21 @@
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
gcp_redis_instance:
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance37
tier: STANDARD_HA
memory_size_gb: 1
region: us-central1
location_id: us-central1-a
redis_version: REDIS_3_2
display_name: Ansible Test Instance
reserved_ip_range: 192.168.0.0/29
labels:
my_key: my_val
other_key: other_val
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -161,10 +161,10 @@
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-instance"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: network-instance
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,25 +15,25 @@
# Pre-test setup
- name: delete a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
#----------------------------------------------------------
- name: create a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
register: result
- name: assert changed is true
assert:
@ -54,14 +54,14 @@
# ----------------------------------------------------------------------------
- name: create a project that already exists
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: present
register: result
- name: assert changed is false
assert:
@ -70,14 +70,14 @@
#----------------------------------------------------------
- name: delete a project
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
register: result
- name: assert changed is true
assert:
@ -98,14 +98,14 @@
# ----------------------------------------------------------------------------
- name: delete a project that does not exist
gcp_resourcemanager_project:
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
name: My Sample Project
id: alextest-{{ 10000000000 | random }}
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
parent:
type: organization
id: 636173955921
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,19 +15,19 @@
# Pre-test setup
- name: delete a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -48,11 +48,11 @@
# ----------------------------------------------------------------------------
- name: create a repository that already exists
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -61,11 +61,11 @@
#----------------------------------------------------------
- name: delete a repository
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -86,11 +86,11 @@
# ----------------------------------------------------------------------------
- name: delete a repository that does not exist
gcp_sourcerepo_repository:
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: projects/{{ gcp_project }}/repos/{{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

View file

@ -15,34 +15,34 @@
# Pre-test setup
- name: create a instance
gcp_spanner_instance:
name: "instance-database"
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: instance-database
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: delete a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -64,12 +64,12 @@
# ----------------------------------------------------------------------------
- name: create a database that already exists
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -78,12 +78,12 @@
#----------------------------------------------------------
- name: delete a database
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -105,12 +105,12 @@
# ----------------------------------------------------------------------------
- name: delete a database that does not exist
gcp_spanner_database:
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: webstore
instance: "{{ instance }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert:
@ -121,15 +121,15 @@
# If errors happen, don't crash the playbook!
- name: delete a instance
gcp_spanner_instance:
name: "instance-database"
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: instance-database
display_name: My Spanner Instance
node_count: 2
labels:
cost_center: ti-1700004
config: regional-us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instance
ignore_errors: true

View file

@ -1,3 +1,2 @@
---
# defaults file
resource_name: '{{resource_prefix}}'
resource_name: "{{ resource_prefix }}"

Some files were not shown because too many files have changed in this diff Show more