Bug fixes for GCP modules (as of 2019-01-09T15:35:45-08:00) (#50783)

This commit is contained in:
Alex Stephen 2019-01-16 11:15:35 -08:00
parent 87d1c171c5
commit fea1568acd
19 changed files with 152 additions and 92 deletions

View file

@ -102,10 +102,9 @@ options:
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes. purposes.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified - 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork in two ways. First, you can place in the selfLink of the resource here as a
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork
you can set this subnetwork to a dictionary with the selfLink key where the task and then set this subnetwork field to "{{ name-of-resource }}"'
value is the selfLink of your Subnetwork'
required: false required: false
version_added: 2.7 version_added: 2.7
region: region:
@ -183,7 +182,7 @@ subnetwork:
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes. purposes.
returned: success returned: success
type: dict type: str
users: users:
description: description:
- The URLs of the resources that are using this address. - The URLs of the resources that are using this address.
@ -221,7 +220,7 @@ def main():
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']),
subnetwork=dict(type='dict'), subnetwork=dict(),
region=dict(required=True, type='str') region=dict(required=True, type='str')
) )
) )

View file

@ -122,7 +122,7 @@ items:
- This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER
purposes. purposes.
returned: success returned: success
type: dict type: str
users: users:
description: description:
- The URLs of the resources that are using this address. - The URLs of the resources that are using this address.

View file

@ -97,10 +97,10 @@ options:
- When the BackendService has load balancing scheme INTERNAL, the instance - When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService. group must be in a zone within the same region as the BackendService.
- 'This field represents a link to a InstanceGroup resource in GCP. It can - 'This field represents a link to a InstanceGroup resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a be specified in two ways. First, you can place in the selfLink of the resource
gcp_compute_instance_group task and then set this group field to "{{ name-of-resource here as a string Alternatively, you can add `register: name-of-resource`
}}" Alternatively, you can set this group to a dictionary with the selfLink to a gcp_compute_instance_group task and then set this group field to "{{
key where the value is the selfLink of your InstanceGroup' name-of-resource }}"'
required: false required: false
max_connections: max_connections:
description: description:
@ -387,7 +387,7 @@ backends:
- When the BackendService has load balancing scheme INTERNAL, the instance group - When the BackendService has load balancing scheme INTERNAL, the instance group
must be in a zone within the same region as the BackendService. must be in a zone within the same region as the BackendService.
returned: success returned: success
type: dict type: str
maxConnections: maxConnections:
description: description:
- The max number of simultaneous connections for the group. Can be used with - The max number of simultaneous connections for the group. Can be used with
@ -626,7 +626,7 @@ def main():
balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']),
capacity_scaler=dict(type='str'), capacity_scaler=dict(type='str'),
description=dict(type='str'), description=dict(type='str'),
group=dict(type='dict'), group=dict(),
max_connections=dict(type='int'), max_connections=dict(type='int'),
max_connections_per_instance=dict(type='int'), max_connections_per_instance=dict(type='int'),
max_rate=dict(type='int'), max_rate=dict(type='int'),

View file

@ -115,7 +115,7 @@ items:
- When the BackendService has load balancing scheme INTERNAL, the instance - When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService. group must be in a zone within the same region as the BackendService.
returned: success returned: success
type: dict type: str
maxConnections: maxConnections:
description: description:
- The max number of simultaneous connections for the group. Can be used - The max number of simultaneous connections for the group. Can be used

View file

@ -157,10 +157,9 @@ options:
- The source snapshot used to create this disk. You can provide this as a partial - The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. or full URL to the resource.
- 'This field represents a link to a Snapshot resource in GCP. It can be specified - '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 in two ways. First, you can place in the selfLink of the resource here as a
task and then set this source_snapshot field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot
you can set this source_snapshot to a dictionary with the selfLink key where task and then set this source_snapshot field to "{{ name-of-resource }}"'
the value is the selfLink of your Snapshot'
required: false required: false
source_snapshot_encryption_key: source_snapshot_encryption_key:
description: description:
@ -351,7 +350,7 @@ sourceSnapshot:
- The source snapshot used to create this disk. You can provide this as a partial - The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. or full URL to the resource.
returned: success returned: success
type: dict type: str
sourceSnapshotEncryptionKey: sourceSnapshotEncryptionKey:
description: description:
- The customer-supplied encryption key of the source snapshot. Required if the source - The customer-supplied encryption key of the source snapshot. Required if the source
@ -418,7 +417,7 @@ def main():
raw_key=dict(type='str'), raw_key=dict(type='str'),
sha256=dict(type='str') sha256=dict(type='str')
)), )),
source_snapshot=dict(type='dict'), source_snapshot=dict(),
source_snapshot_encryption_key=dict(type='dict', options=dict( source_snapshot_encryption_key=dict(type='dict', options=dict(
raw_key=dict(type='str'), raw_key=dict(type='str'),
sha256=dict(type='str') sha256=dict(type='str')

View file

@ -224,7 +224,7 @@ items:
- The source snapshot used to create this disk. You can provide this as a partial - The source snapshot used to create this disk. You can provide this as a partial
or full URL to the resource. or full URL to the resource.
returned: success returned: success
type: dict type: str
sourceSnapshotEncryptionKey: sourceSnapshotEncryptionKey:
description: description:
- The customer-supplied encryption key of the source snapshot. Required if the - The customer-supplied encryption key of the source snapshot. Required if the

View file

@ -147,10 +147,9 @@ options:
networks/my-network projects/myproject/global/networks/my-network global/networks/default networks/my-network projects/myproject/global/networks/my-network global/networks/default
.' .'
- 'This field represents a link to a Network resource in GCP. It can be specified - 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network in two ways. First, you can place in the selfLink of the resource here as a
task and then set this network field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network
you can set this network to a dictionary with the selfLink key where the value task and then set this network field to "{{ name-of-resource }}"'
is the selfLink of your Network'
required: false required: false
default: default:
selfLink: global/networks/default selfLink: global/networks/default
@ -343,7 +342,7 @@ network:
networks/my-network projects/myproject/global/networks/my-network global/networks/default networks/my-network projects/myproject/global/networks/my-network global/networks/default
.' .'
returned: success returned: success
type: dict type: str
priority: priority:
description: description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive. - Priority for this rule. This is an integer between 0 and 65535, both inclusive.
@ -441,7 +440,7 @@ def main():
direction=dict(type='str', choices=['INGRESS', 'EGRESS']), direction=dict(type='str', choices=['INGRESS', 'EGRESS']),
disabled=dict(type='bool'), disabled=dict(type='bool'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network=dict(default={'selfLink': 'global/networks/default'}, type='dict'), network=dict(default={'selfLink': 'global/networks/default'}),
priority=dict(default=1000, type='int'), priority=dict(default=1000, type='int'),
source_ranges=dict(type='list', elements='str'), source_ranges=dict(type='list', elements='str'),
source_service_accounts=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'),

View file

@ -170,7 +170,7 @@ items:
networks/my-network projects/myproject/global/networks/my-network global/networks/default networks/my-network projects/myproject/global/networks/my-network global/networks/default
.' .'
returned: success returned: success
type: dict type: str
priority: priority:
description: description:
- Priority for this rule. This is an integer between 0 and 65535, both inclusive. - Priority for this rule. This is an integer between 0 and 65535, both inclusive.

View file

@ -96,10 +96,10 @@ options:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be - 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service specified in two ways. First, you can place in the selfLink of the resource
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this backend_service to a dictionary with the selfLink key where a gcp_compute_backend_service task and then set this backend_service field to
the value is the selfLink of your BackendService' "{{ name-of-resource }}"'
required: false required: false
ip_version: ip_version:
description: description:
@ -136,10 +136,9 @@ options:
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified - 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network in two ways. First, you can place in the selfLink of the resource here as a
task and then set this network field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network
you can set this network to a dictionary with the selfLink key where the value task and then set this network field to "{{ name-of-resource }}"'
is the selfLink of your Network'
required: false required: false
port_range: port_range:
description: description:
@ -172,10 +171,9 @@ options:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified - 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork in two ways. First, you can place in the selfLink of the resource here as a
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork
you can set this subnetwork to a dictionary with the selfLink key where the task and then set this subnetwork field to "{{ name-of-resource }}"'
value is the selfLink of your Subnetwork'
required: false required: false
target: target:
description: description:
@ -186,10 +184,9 @@ options:
target object. target object.
- This field is not used for internal load balancing. - This field is not used for internal load balancing.
- 'This field represents a link to a TargetPool resource in GCP. It can be specified - 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool in two ways. First, you can place in the selfLink of the resource here as a
task and then set this target field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool
you can set this target to a dictionary with the selfLink key where the value task and then set this target field to "{{ name-of-resource }}"'
is the selfLink of your TargetPool'
required: false required: false
version_added: 2.7 version_added: 2.7
network_tier: network_tier:
@ -301,7 +298,7 @@ backendService:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
returned: success returned: success
type: dict type: str
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4 - The IP Version that will be used by this forwarding rule. Valid options are IPV4
@ -334,7 +331,7 @@ network:
the default network will be used. the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
portRange: portRange:
description: description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
@ -367,7 +364,7 @@ subnetwork:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
target: target:
description: description:
- A reference to a TargetPool resource to receive the matched traffic. - A reference to a TargetPool resource to receive the matched traffic.
@ -377,7 +374,7 @@ target:
target object. target object.
- This field is not used for internal load balancing. - This field is not used for internal load balancing.
returned: success returned: success
type: dict type: str
networkTier: networkTier:
description: description:
- 'The networking tier used for configuring this address. This field can take the - 'The networking tier used for configuring this address. This field can take the
@ -415,15 +412,15 @@ def main():
description=dict(type='str'), description=dict(type='str'),
ip_address=dict(type='str'), ip_address=dict(type='str'),
ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']),
backend_service=dict(type='dict'), backend_service=dict(),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']), ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network=dict(type='dict'), network=dict(),
port_range=dict(type='str'), port_range=dict(type='str'),
ports=dict(type='list', elements='str'), ports=dict(type='list', elements='str'),
subnetwork=dict(type='dict'), subnetwork=dict(),
target=dict(type='dict'), target=dict(),
network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']),
region=dict(required=True, type='str') region=dict(required=True, type='str')
) )

View file

@ -123,7 +123,7 @@ items:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
returned: success returned: success
type: dict type: str
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - The IP Version that will be used by this forwarding rule. Valid options are
@ -156,7 +156,7 @@ items:
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
portRange: portRange:
description: description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
@ -191,7 +191,7 @@ items:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
target: target:
description: description:
- A reference to a TargetPool resource to receive the matched traffic. - A reference to a TargetPool resource to receive the matched traffic.
@ -201,7 +201,7 @@ items:
to the target object. to the target object.
- This field is not used for internal load balancing. - This field is not used for internal load balancing.
returned: success returned: success
type: dict type: str
networkTier: networkTier:
description: description:
- 'The networking tier used for configuring this address. This field can take - 'The networking tier used for configuring this address. This field can take

View file

@ -49,6 +49,11 @@ options:
- present - present
- absent - absent
default: present default: present
address:
description:
- The static external IP address represented by this resource.
required: false
version_added: 2.8
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -170,6 +175,7 @@ def main():
module = GcpModule( module = GcpModule(
argument_spec=dict( argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(default='present', choices=['present', 'absent'], type='str'),
address=dict(type='str'),
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']), ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
@ -225,6 +231,7 @@ def delete(module, link, kind):
def resource_to_request(module): def resource_to_request(module):
request = { request = {
u'kind': 'compute#address', u'kind': 'compute#address',
u'address': module.params.get('address'),
u'description': module.params.get('description'), u'description': module.params.get('description'),
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'ipVersion': module.params.get('ip_version'), u'ipVersion': module.params.get('ip_version'),

View file

@ -98,10 +98,10 @@ options:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be - 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service specified in two ways. First, you can place in the selfLink of the resource
task and then set this backend_service field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this backend_service to a dictionary with the selfLink key where a gcp_compute_backend_service task and then set this backend_service field to
the value is the selfLink of your BackendService' "{{ name-of-resource }}"'
required: false required: false
ip_version: ip_version:
description: description:
@ -138,10 +138,9 @@ options:
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified - 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_network in two ways. First, you can place in the selfLink of the resource here as a
task and then set this network field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network
you can set this network to a dictionary with the selfLink key where the value task and then set this network field to "{{ name-of-resource }}"'
is the selfLink of your Network'
required: false required: false
port_range: port_range:
description: description:
@ -174,10 +173,9 @@ options:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- 'This field represents a link to a Subnetwork resource in GCP. It can be specified - 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_subnetwork in two ways. First, you can place in the selfLink of the resource here as a
task and then set this subnetwork field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork
you can set this subnetwork to a dictionary with the selfLink key where the task and then set this subnetwork field to "{{ name-of-resource }}"'
value is the selfLink of your Subnetwork'
required: false required: false
target: target:
description: description:
@ -321,7 +319,7 @@ backendService:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
returned: success returned: success
type: dict type: str
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4 - The IP Version that will be used by this forwarding rule. Valid options are IPV4
@ -354,7 +352,7 @@ network:
the default network will be used. the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
portRange: portRange:
description: description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
@ -387,7 +385,7 @@ subnetwork:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
region: region:
description: description:
- A reference to the region where the regional forwarding rule resides. - A reference to the region where the regional forwarding rule resides.
@ -425,14 +423,14 @@ def main():
description=dict(type='str'), description=dict(type='str'),
ip_address=dict(type='str'), ip_address=dict(type='str'),
ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']),
backend_service=dict(type='dict'), backend_service=dict(),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']), ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network=dict(type='dict'), network=dict(),
port_range=dict(type='str'), port_range=dict(type='str'),
ports=dict(type='list', elements='str'), ports=dict(type='list', elements='str'),
subnetwork=dict(type='dict'), subnetwork=dict(),
target=dict(type='str') target=dict(type='str')
) )
) )

View file

@ -117,7 +117,7 @@ items:
- This is used for internal load balancing. - This is used for internal load balancing.
- "(not used for external load balancing) ." - "(not used for external load balancing) ."
returned: success returned: success
type: dict type: str
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - The IP Version that will be used by this forwarding rule. Valid options are
@ -150,7 +150,7 @@ items:
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
portRange: portRange:
description: description:
- This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy,
@ -185,7 +185,7 @@ items:
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing. - This field is not used for external load balancing.
returned: success returned: success
type: dict type: str
region: region:
description: description:
- A reference to the region where the regional forwarding rule resides. - A reference to the region where the regional forwarding rule resides.

View file

@ -112,6 +112,11 @@ options:
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption - The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption
key that protects this resource. key that protects this resource.
required: false required: false
labels:
description:
- Labels to apply to this Image.
required: false
version_added: 2.8
licenses: licenses:
description: description:
- Any applicable license URI. - Any applicable license URI.
@ -147,16 +152,16 @@ options:
description: description:
- The full Google Cloud Storage URL where disk storage is stored You must - The full Google Cloud Storage URL where disk storage is stored You must
provide either this property or the sourceDisk property but not both. provide either this property or the sourceDisk property but not both.
required: false required: true
source_disk: source_disk:
description: description:
- Refers to a gcompute_disk object You must provide either this property or the - The source disk to create this image based on.
rawDisk.source property but not both to create an image. - You must provide either this property or the rawDisk.source property but not
both to create an image.
- 'This field represents a link to a Disk resource in GCP. It can be specified - 'This field represents a link to a Disk resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_disk in two ways. First, you can place in the selfLink of the resource here as a
task and then set this source_disk field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_disk
you can set this source_disk to a dictionary with the selfLink key where the task and then set this source_disk field to "{{ name-of-resource }}"'
value is the selfLink of your Disk'
required: false required: false
source_disk_encryption_key: source_disk_encryption_key:
description: description:
@ -188,6 +193,9 @@ options:
choices: choices:
- RAW - RAW
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/images)'
- 'Official Documentation: U(https://cloud.google.com/compute/docs/images)'
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -330,6 +338,17 @@ imageEncryptionKey:
key that protects this resource. key that protects this resource.
returned: success returned: success
type: str type: str
labels:
description:
- Labels to apply to this Image.
returned: success
type: dict
labelFingerprint:
description:
- The fingerprint used for optimistic locking of this resource. Used internally
during updates.
returned: success
type: str
licenses: licenses:
description: description:
- Any applicable license URI. - Any applicable license URI.
@ -372,10 +391,11 @@ rawDisk:
type: str type: str
sourceDisk: sourceDisk:
description: description:
- Refers to a gcompute_disk object You must provide either this property or the - The source disk to create this image based on.
rawDisk.source property but not both to create an image. - You must provide either this property or the rawDisk.source property but not both
to create an image.
returned: success returned: success
type: dict type: str
sourceDiskEncryptionKey: sourceDiskEncryptionKey:
description: description:
- The customer-supplied encryption key of the source disk. Required if the source - The customer-supplied encryption key of the source disk. Required if the source
@ -439,14 +459,15 @@ def main():
raw_key=dict(type='str'), raw_key=dict(type='str'),
sha256=dict(type='str') sha256=dict(type='str')
)), )),
labels=dict(type='dict'),
licenses=dict(type='list', elements='str'), licenses=dict(type='list', elements='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
raw_disk=dict(type='dict', options=dict( raw_disk=dict(type='dict', options=dict(
container_type=dict(type='str', choices=['TAR']), container_type=dict(type='str', choices=['TAR']),
sha1_checksum=dict(type='str'), sha1_checksum=dict(type='str'),
source=dict(type='str') source=dict(required=True, type='str')
)), )),
source_disk=dict(type='dict'), source_disk=dict(),
source_disk_encryption_key=dict(type='dict', options=dict( source_disk_encryption_key=dict(type='dict', options=dict(
raw_key=dict(type='str'), raw_key=dict(type='str'),
sha256=dict(type='str') sha256=dict(type='str')
@ -468,7 +489,7 @@ def main():
if fetch: if fetch:
if state == 'present': if state == 'present':
if is_different(module, fetch): if is_different(module, fetch):
update(module, self_link(module), kind) update(module, self_link(module), kind, fetch)
fetch = fetch_resource(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind)
changed = True changed = True
else: else:
@ -492,9 +513,29 @@ def create(module, link, kind):
return wait_for_operation(module, auth.post(link, resource_to_request(module))) return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link, kind): def update(module, link, kind, fetch):
update_fields(module, resource_to_request(module),
response_to_hash(module, fetch))
return fetch_resource(module, self_link(module), kind)
def update_fields(module, request, response):
if response.get('labels') != request.get('labels'):
labels_update(module, request, response)
def labels_update(module, request, response):
auth = GcpSession(module, 'compute') auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.put(link, resource_to_request(module))) auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/images/{name}/setLabels"
]).format(**module.params),
{
u'labels': module.params.get('labels'),
u'labelFingerprint': response.get('labelFingerprint')
}
)
def delete(module, link, kind): def delete(module, link, kind):
@ -510,6 +551,7 @@ def resource_to_request(module):
u'family': module.params.get('family'), u'family': module.params.get('family'),
u'guestOsFeatures': ImageGuestosfeaturesArray(module.params.get('guest_os_features', []), module).to_request(), u'guestOsFeatures': ImageGuestosfeaturesArray(module.params.get('guest_os_features', []), module).to_request(),
u'imageEncryptionKey': ImageImageencryptionkey(module.params.get('image_encryption_key', {}), module).to_request(), u'imageEncryptionKey': ImageImageencryptionkey(module.params.get('image_encryption_key', {}), module).to_request(),
u'labels': module.params.get('labels'),
u'licenses': module.params.get('licenses'), u'licenses': module.params.get('licenses'),
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'rawDisk': ImageRawdisk(module.params.get('raw_disk', {}), module).to_request(), u'rawDisk': ImageRawdisk(module.params.get('raw_disk', {}), module).to_request(),
@ -591,6 +633,8 @@ def response_to_hash(module, response):
u'guestOsFeatures': ImageGuestosfeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(), u'guestOsFeatures': ImageGuestosfeaturesArray(response.get(u'guestOsFeatures', []), module).from_response(),
u'id': response.get(u'id'), u'id': response.get(u'id'),
u'imageEncryptionKey': ImageImageencryptionkey(response.get(u'imageEncryptionKey', {}), module).from_response(), u'imageEncryptionKey': ImageImageencryptionkey(response.get(u'imageEncryptionKey', {}), module).from_response(),
u'labels': response.get(u'labels'),
u'labelFingerprint': response.get(u'labelFingerprint'),
u'licenses': response.get(u'licenses'), u'licenses': response.get(u'licenses'),
u'name': response.get(u'name'), u'name': response.get(u'name'),
u'rawDisk': ImageRawdisk(response.get(u'rawDisk', {}), module).from_response(), u'rawDisk': ImageRawdisk(response.get(u'rawDisk', {}), module).from_response(),

View file

@ -129,6 +129,7 @@
- result.has_key('kind') == False - result.has_key('kind') == False
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a bucket - name: delete a bucket
gcp_storage_bucket: gcp_storage_bucket:
name: "bucket-backendbucket" name: "bucket-backendbucket"
@ -137,3 +138,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: bucket register: bucket
ignore_errors: true

View file

@ -152,6 +152,7 @@
- result.has_key('kind') == False - result.has_key('kind') == False
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a http health check - name: delete a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "httphealthcheck-backendservice" name: "httphealthcheck-backendservice"
@ -164,6 +165,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: healthcheck register: healthcheck
ignore_errors: true
- name: delete a instance group - name: delete a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "instancegroup-backendservice" name: "instancegroup-backendservice"
@ -173,3 +175,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: instancegroup register: instancegroup
ignore_errors: true

View file

@ -151,6 +151,7 @@
- result.has_key('kind') == False - result.has_key('kind') == False
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a target pool - name: delete a target pool
gcp_compute_target_pool: gcp_compute_target_pool:
name: "targetpool-forwardingrule" name: "targetpool-forwardingrule"
@ -160,6 +161,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: targetpool register: targetpool
ignore_errors: true
- name: delete a address - name: delete a address
gcp_compute_address: gcp_compute_address:
name: "address-forwardingrule" name: "address-forwardingrule"
@ -169,3 +171,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: address register: address
ignore_errors: true

View file

@ -186,6 +186,7 @@
- result.has_key('kind') == False - result.has_key('kind') == False
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a target http proxy - name: delete a target http proxy
gcp_compute_target_http_proxy: gcp_compute_target_http_proxy:
name: "targethttpproxy-globalforwardingrule" name: "targethttpproxy-globalforwardingrule"
@ -195,6 +196,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: httpproxy register: httpproxy
ignore_errors: true
- name: delete a url map - name: delete a url map
gcp_compute_url_map: gcp_compute_url_map:
name: "urlmap-globalforwardingrule" name: "urlmap-globalforwardingrule"
@ -204,6 +206,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: urlmap register: urlmap
ignore_errors: true
- name: delete a backend service - name: delete a backend service
gcp_compute_backend_service: gcp_compute_backend_service:
name: "backendservice-globalforwardingrule" name: "backendservice-globalforwardingrule"
@ -217,6 +220,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: backendservice register: backendservice
ignore_errors: true
- name: delete a http health check - name: delete a http health check
gcp_compute_http_health_check: gcp_compute_http_health_check:
name: "httphealthcheck-globalforwardingrule" name: "httphealthcheck-globalforwardingrule"
@ -229,6 +233,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: healthcheck register: healthcheck
ignore_errors: true
- name: delete a instance group - name: delete a instance group
gcp_compute_instance_group: gcp_compute_instance_group:
name: "instancegroup-globalforwardingrule" name: "instancegroup-globalforwardingrule"
@ -238,6 +243,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: instancegroup register: instancegroup
ignore_errors: true
- name: delete a global address - name: delete a global address
gcp_compute_global_address: gcp_compute_global_address:
name: "globaladdress-globalforwardingrule" name: "globaladdress-globalforwardingrule"
@ -246,3 +252,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: globaladdress register: globaladdress
ignore_errors: true

View file

@ -120,6 +120,7 @@
- result.has_key('kind') == False - result.has_key('kind') == False
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a disk - name: delete a disk
gcp_compute_disk: gcp_compute_disk:
name: "disk-image" name: "disk-image"
@ -129,3 +130,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: disk register: disk
ignore_errors: true