1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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

This commit is contained in:
Alex Stephen 2019-01-16 11:15:03 -08:00 committed by ansibot
parent eca7c3c8c7
commit 5ca5936e05
32 changed files with 282 additions and 188 deletions

View file

@ -95,7 +95,7 @@ items:
- A reference to the UrlMap resource that defines the mapping from URL to the - A reference to the UrlMap resource that defines the mapping from URL to the
BackendService. BackendService.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################

View file

@ -81,15 +81,25 @@ options:
between users and the load balancer. Currently, exactly one SSL certificate between users and the load balancer. Currently, exactly one SSL certificate
must be specified. must be specified.
required: true required: true
ssl_policy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy
resource. If not set, the TargetHttpsProxy resource will not have any SSL policy
configured.
- 'This field represents a link to a SslPolicy resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy
task and then set this ssl_policy field to "{{ name-of-resource }}"'
required: false
version_added: 2.8
url_map: url_map:
description: description:
- A reference to the UrlMap resource that defines the mapping from URL to the - A reference to the UrlMap resource that defines the mapping from URL to the
BackendService. BackendService.
- 'This field represents a link to a UrlMap resource in GCP. It can be specified - 'This field represents a link to a UrlMap resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_url_map in two ways. First, you can place in the selfLink of the resource here as a
task and then set this url_map field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_url_map
you can set this url_map to a dictionary with the selfLink key where the value task and then set this url_map field to "{{ name-of-resource }}"'
is the selfLink of your UrlMap'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
@ -232,11 +242,18 @@ sslCertificates:
users and the load balancer. Currently, exactly one SSL certificate must be specified. users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success returned: success
type: list type: list
sslPolicy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy
resource. If not set, the TargetHttpsProxy resource will not have any SSL policy
configured.
returned: success
type: str
urlMap: urlMap:
description: description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService. - A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################
@ -261,8 +278,9 @@ def main():
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']), quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']),
ssl_certificates=dict(required=True, type='list', elements='dict'), ssl_certificates=dict(required=True, type='list'),
url_map=dict(required=True, type='dict') ssl_policy=dict(),
url_map=dict(required=True)
) )
) )
@ -313,6 +331,8 @@ def update_fields(module, request, response):
quic_override_update(module, request, response) quic_override_update(module, request, response)
if response.get('sslCertificates') != request.get('sslCertificates'): if response.get('sslCertificates') != request.get('sslCertificates'):
ssl_certificates_update(module, request, response) ssl_certificates_update(module, request, response)
if response.get('sslPolicy') != request.get('sslPolicy'):
ssl_policy_update(module, request, response)
if response.get('urlMap') != request.get('urlMap'): if response.get('urlMap') != request.get('urlMap'):
url_map_update(module, request, response) url_map_update(module, request, response)
@ -343,6 +363,19 @@ def ssl_certificates_update(module, request, response):
) )
def ssl_policy_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/targetHttpsProxies/{name}/setSslPolicy"
]).format(**module.params),
{
u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')
}
)
def url_map_update(module, request, response): def url_map_update(module, request, response):
auth = GcpSession(module, 'compute') auth = GcpSession(module, 'compute')
auth.post( auth.post(
@ -368,6 +401,7 @@ def resource_to_request(module):
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'quicOverride': module.params.get('quic_override'), u'quicOverride': module.params.get('quic_override'),
u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'), u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'),
u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink'),
u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink') u'urlMap': replace_resource_dict(module.params.get(u'url_map', {}), 'selfLink')
} }
return_vals = {} return_vals = {}
@ -440,6 +474,7 @@ def response_to_hash(module, response):
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'quicOverride': response.get(u'quicOverride'), u'quicOverride': response.get(u'quicOverride'),
u'sslCertificates': response.get(u'sslCertificates'), u'sslCertificates': response.get(u'sslCertificates'),
u'sslPolicy': response.get(u'sslPolicy'),
u'urlMap': response.get(u'urlMap') u'urlMap': response.get(u'urlMap')
} }

View file

@ -106,12 +106,19 @@ items:
must be specified. must be specified.
returned: success returned: success
type: list type: list
sslPolicy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy
resource. If not set, the TargetHttpsProxy resource will not have any SSL
policy configured.
returned: success
type: str
urlMap: urlMap:
description: description:
- A reference to the UrlMap resource that defines the mapping from URL to the - A reference to the UrlMap resource that defines the mapping from URL to the
BackendService. BackendService.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################

View file

@ -62,10 +62,9 @@ options:
pool in the "force" mode, where traffic will be spread to the healthy instances pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy. with the best effort, or to all instances when no instance is healthy.
- '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 backup_pool 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 backup_pool to a dictionary with the selfLink key where the task and then set this backup_pool field to "{{ name-of-resource }}"'
value is the selfLink of your TargetPool'
required: false required: false
description: description:
description: description:
@ -92,10 +91,10 @@ options:
checks pass. If not specified it means all member instances will be considered checks pass. If not specified it means all member instances will be considered
healthy at all times. healthy at all times.
- 'This field represents a link to a HttpHealthCheck resource in GCP. It can be - 'This field represents a link to a HttpHealthCheck resource in GCP. It can be
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_http_health_check specified in two ways. First, you can place in the selfLink of the resource
task and then set this health_check field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this health_check to a dictionary with the selfLink key where the a gcp_compute_http_health_check task and then set this health_check field to
value is the selfLink of your HttpHealthCheck' "{{ name-of-resource }}"'
required: false required: false
instances: instances:
description: description:
@ -160,7 +159,7 @@ backupPool:
pool in the "force" mode, where traffic will be spread to the healthy instances pool in the "force" mode, where traffic will be spread to the healthy instances
with the best effort, or to all instances when no instance is healthy. with the best effort, or to all instances when no instance is healthy.
returned: success returned: success
type: dict type: str
creationTimestamp: creationTimestamp:
description: description:
- Creation timestamp in RFC3339 text format. - Creation timestamp in RFC3339 text format.
@ -193,7 +192,7 @@ healthCheck:
checks pass. If not specified it means all member instances will be considered checks pass. If not specified it means all member instances will be considered
healthy at all times. healthy at all times.
returned: success returned: success
type: dict type: str
id: id:
description: description:
- The unique identifier for the resource. - The unique identifier for the resource.
@ -251,11 +250,11 @@ 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'),
backup_pool=dict(type='dict'), backup_pool=dict(),
description=dict(type='str'), description=dict(type='str'),
failover_ratio=dict(type='str'), failover_ratio=dict(type='str'),
health_check=dict(type='dict'), health_check=dict(),
instances=dict(type='list', elements='dict'), instances=dict(type='list'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']),
region=dict(required=True, type='str') region=dict(required=True, type='str')

View file

@ -84,7 +84,7 @@ items:
primary pool in the "force" mode, where traffic will be spread to the healthy primary pool in the "force" mode, where traffic will be spread to the healthy
instances with the best effort, or to all instances when no instance is healthy. instances with the best effort, or to all instances when no instance is healthy.
returned: success returned: success
type: dict type: str
creationTimestamp: creationTimestamp:
description: description:
- Creation timestamp in RFC3339 text format. - Creation timestamp in RFC3339 text format.
@ -117,7 +117,7 @@ items:
checks pass. If not specified it means all member instances will be considered checks pass. If not specified it means all member instances will be considered
healthy at all times. healthy at all times.
returned: success returned: success
type: dict type: str
id: id:
description: description:
- The unique identifier for the resource. - The unique identifier for the resource.

View file

@ -74,10 +74,10 @@ options:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
- '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 service field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this service to a dictionary with the selfLink key where the value a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource
is the selfLink of your BackendService' }}"'
required: true required: true
ssl_certificates: ssl_certificates:
description: description:
@ -85,6 +85,17 @@ options:
between users and the load balancer. Currently, exactly one SSL certificate between users and the load balancer. Currently, exactly one SSL certificate
must be specified. must be specified.
required: true required: true
ssl_policy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetSslProxy
resource. If not set, the TargetSslProxy resource will not have any SSL policy
configured.
- 'This field represents a link to a SslPolicy resource in GCP. It can be specified
in two ways. First, you can place in the selfLink of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_compute_ssl_policy
task and then set this ssl_policy field to "{{ name-of-resource }}"'
required: false
version_added: 2.8
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)' - 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)'
@ -215,13 +226,20 @@ service:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
returned: success returned: success
type: dict type: str
sslCertificates: sslCertificates:
description: description:
- A list of SslCertificate resources that are used to authenticate connections between - A list of SslCertificate resources that are used to authenticate connections between
users and the load balancer. Currently, exactly one SSL certificate must be specified. users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success returned: success
type: list type: list
sslPolicy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetSslProxy
resource. If not set, the TargetSslProxy resource will not have any SSL policy
configured.
returned: success
type: str
''' '''
################################################################################ ################################################################################
@ -246,8 +264,9 @@ def main():
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']),
service=dict(required=True, type='dict'), service=dict(required=True),
ssl_certificates=dict(required=True, type='list', elements='dict') ssl_certificates=dict(required=True, type='list'),
ssl_policy=dict()
) )
) )
@ -300,6 +319,8 @@ def update_fields(module, request, response):
service_update(module, request, response) service_update(module, request, response)
if response.get('sslCertificates') != request.get('sslCertificates'): if response.get('sslCertificates') != request.get('sslCertificates'):
ssl_certificates_update(module, request, response) ssl_certificates_update(module, request, response)
if response.get('sslPolicy') != request.get('sslPolicy'):
ssl_policy_update(module, request, response)
def proxy_header_update(module, request, response): def proxy_header_update(module, request, response):
@ -341,6 +362,19 @@ def ssl_certificates_update(module, request, response):
) )
def ssl_policy_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join([
"https://www.googleapis.com/compute/v1/",
"projects/{project}/global/targetSslProxies/{name}/setSslPolicy"
]).format(**module.params),
{
u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')
}
)
def delete(module, link, kind): def delete(module, link, kind):
auth = GcpSession(module, 'compute') auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.delete(link)) return wait_for_operation(module, auth.delete(link))
@ -353,7 +387,8 @@ def resource_to_request(module):
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'proxyHeader': module.params.get('proxy_header'), u'proxyHeader': module.params.get('proxy_header'),
u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink'), u'service': replace_resource_dict(module.params.get(u'service', {}), 'selfLink'),
u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink') u'sslCertificates': replace_resource_dict(module.params.get('ssl_certificates', []), 'selfLink'),
u'sslPolicy': replace_resource_dict(module.params.get(u'ssl_policy', {}), 'selfLink')
} }
return_vals = {} return_vals = {}
for k, v in request.items(): for k, v in request.items():
@ -425,7 +460,8 @@ def response_to_hash(module, response):
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'proxyHeader': response.get(u'proxyHeader'), u'proxyHeader': response.get(u'proxyHeader'),
u'service': response.get(u'service'), u'service': response.get(u'service'),
u'sslCertificates': response.get(u'sslCertificates') u'sslCertificates': response.get(u'sslCertificates'),
u'sslPolicy': response.get(u'sslPolicy')
} }

View file

@ -100,7 +100,7 @@ items:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
returned: success returned: success
type: dict type: str
sslCertificates: sslCertificates:
description: description:
- A list of SslCertificate resources that are used to authenticate connections - A list of SslCertificate resources that are used to authenticate connections
@ -108,6 +108,13 @@ items:
must be specified. must be specified.
returned: success returned: success
type: list type: list
sslPolicy:
description:
- A reference to the SslPolicy resource that will be associated with the TargetSslProxy
resource. If not set, the TargetSslProxy resource will not have any SSL policy
configured.
returned: success
type: str
''' '''
################################################################################ ################################################################################

View file

@ -74,10 +74,10 @@ options:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
- '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 service field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this service to a dictionary with the selfLink key where the value a gcp_compute_backend_service task and then set this service field to "{{ name-of-resource
is the selfLink of your BackendService' }}"'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
notes: notes:
@ -174,7 +174,7 @@ service:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################
@ -199,7 +199,7 @@ def main():
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']), proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']),
service=dict(required=True, type='dict') service=dict(required=True)
) )
) )

View file

@ -100,7 +100,7 @@ items:
description: description:
- A reference to the BackendService resource. - A reference to the BackendService resource.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################

View file

@ -66,10 +66,9 @@ options:
description: description:
- The network this VPN gateway is accepting traffic for. - The network this VPN gateway is accepting traffic for.
- '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: true required: true
region: region:
description: description:
@ -141,15 +140,16 @@ network:
description: description:
- The network this VPN gateway is accepting traffic for. - The network this VPN gateway is accepting traffic for.
returned: success returned: success
type: dict type: str
tunnels: tunnels:
description: description:
- A list of references to VpnTunnel resources associated to this VPN gateway. - A list of references to VpnTunnel resources associated with this VPN gateway.
returned: success returned: success
type: list type: list
forwardingRules: forwardingRules:
description: description:
- A list of references to the ForwardingRule resources associated to this VPN gateway. - A list of references to the ForwardingRule resources associated with this VPN
gateway.
returned: success returned: success
type: list type: list
region: region:
@ -180,7 +180,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(default='present', choices=['present', 'absent'], type='str'),
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network=dict(required=True, type='dict'), network=dict(required=True),
region=dict(required=True, type='str') region=dict(required=True, type='str')
) )
) )

View file

@ -99,16 +99,16 @@ items:
description: description:
- The network this VPN gateway is accepting traffic for. - The network this VPN gateway is accepting traffic for.
returned: success returned: success
type: dict type: str
tunnels: tunnels:
description: description:
- A list of references to VpnTunnel resources associated to this VPN gateway. - A list of references to VpnTunnel resources associated with this VPN gateway.
returned: success returned: success
type: list type: list
forwardingRules: forwardingRules:
description: description:
- A list of references to the ForwardingRule resources associated to this VPN - A list of references to the ForwardingRule resources associated with this
gateway. VPN gateway.
returned: success returned: success
type: list type: list
region: region:

View file

@ -53,10 +53,10 @@ options:
description: description:
- A reference to BackendService resource if none of the hostRules match. - A reference to BackendService resource if none of the hostRules match.
- '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 default_service field to "{{ name-of-resource }}" Alternatively, here as a string Alternatively, you can add `register: name-of-resource` to
you can set this default_service to a dictionary with the selfLink key where a gcp_compute_backend_service task and then set this default_service field to
the value is the selfLink of your BackendService' "{{ name-of-resource }}"'
required: true required: true
description: description:
description: description:
@ -103,11 +103,10 @@ options:
- A reference to a BackendService resource. This will be used if none of the - A reference to a BackendService resource. This will be used if none of the
pathRules defined by this PathMatcher is matched by the URL's path portion. pathRules defined by this PathMatcher is matched by the URL's path portion.
- 'This field represents a link to a BackendService resource in GCP. It can - '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 be specified in two ways. First, you can place in the selfLink of the resource
gcp_compute_backend_service task and then set this default_service field here as a string Alternatively, you can add `register: name-of-resource`
to "{{ name-of-resource }}" Alternatively, you can set this default_service to a gcp_compute_backend_service task and then set this default_service
to a dictionary with the selfLink key where the value is the selfLink of field to "{{ name-of-resource }}"'
your BackendService'
required: true required: true
description: description:
description: description:
@ -133,11 +132,10 @@ options:
description: description:
- A reference to the BackendService resource if this rule is matched. - A reference to the BackendService resource if this rule is matched.
- 'This field represents a link to a BackendService resource in GCP. It - '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` can be specified in two ways. First, you can place in the selfLink of
to a gcp_compute_backend_service task and then set this service field the resource here as a string Alternatively, you can add `register:
to "{{ name-of-resource }}" Alternatively, you can set this service name-of-resource` to a gcp_compute_backend_service task and then set
to a dictionary with the selfLink key where the value is the selfLink this service field to "{{ name-of-resource }}"'
of your BackendService'
required: true required: true
tests: tests:
description: description:
@ -162,10 +160,10 @@ options:
- A reference to expected BackendService resource the given URL should be - A reference to expected BackendService resource the given URL should be
mapped to. mapped to.
- 'This field represents a link to a BackendService resource in GCP. It can - '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 be specified in two ways. First, you can place in the selfLink of the resource
gcp_compute_backend_service task and then set this service field to "{{ here as a string Alternatively, you can add `register: name-of-resource`
name-of-resource }}" Alternatively, you can set this service to a dictionary to a gcp_compute_backend_service task and then set this service field to
with the selfLink key where the value is the selfLink of your BackendService' "{{ name-of-resource }}"'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -228,7 +226,7 @@ defaultService:
description: description:
- A reference to BackendService resource if none of the hostRules match. - A reference to BackendService resource if none of the hostRules match.
returned: success returned: success
type: dict type: str
description: description:
description: description:
- An optional description of this resource. Provide this property when you create - An optional description of this resource. Provide this property when you create
@ -292,7 +290,7 @@ pathMatchers:
- A reference to a BackendService resource. This will be used if none of the - A reference to a BackendService resource. This will be used if none of the
pathRules defined by this PathMatcher is matched by the URL's path portion. pathRules defined by this PathMatcher is matched by the URL's path portion.
returned: success returned: success
type: dict type: str
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -321,7 +319,7 @@ pathMatchers:
description: description:
- A reference to the BackendService resource if this rule is matched. - A reference to the BackendService resource if this rule is matched.
returned: success returned: success
type: dict type: str
tests: tests:
description: description:
- The list of expected URL mappings. Requests to update this UrlMap will succeed - The list of expected URL mappings. Requests to update this UrlMap will succeed
@ -349,7 +347,7 @@ tests:
- A reference to expected BackendService resource the given URL should be mapped - A reference to expected BackendService resource the given URL should be mapped
to. to.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################
@ -371,7 +369,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'),
default_service=dict(required=True, type='dict'), default_service=dict(required=True),
description=dict(type='str'), description=dict(type='str'),
host_rules=dict(type='list', elements='dict', options=dict( host_rules=dict(type='list', elements='dict', options=dict(
description=dict(type='str'), description=dict(type='str'),
@ -380,19 +378,19 @@ def main():
)), )),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
path_matchers=dict(type='list', elements='dict', options=dict( path_matchers=dict(type='list', elements='dict', options=dict(
default_service=dict(required=True, type='dict'), default_service=dict(required=True),
description=dict(type='str'), description=dict(type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
path_rules=dict(type='list', elements='dict', options=dict( path_rules=dict(type='list', elements='dict', options=dict(
paths=dict(required=True, type='list', elements='str'), paths=dict(required=True, type='list', elements='str'),
service=dict(required=True, type='dict') service=dict(required=True)
)) ))
)), )),
tests=dict(type='list', elements='dict', options=dict( tests=dict(type='list', elements='dict', options=dict(
description=dict(type='str'), description=dict(type='str'),
host=dict(required=True, type='str'), host=dict(required=True, type='str'),
path=dict(required=True, type='str'), path=dict(required=True, type='str'),
service=dict(required=True, type='dict') service=dict(required=True)
)) ))
) )
) )

View file

@ -74,7 +74,7 @@ items:
description: description:
- A reference to BackendService resource if none of the hostRules match. - A reference to BackendService resource if none of the hostRules match.
returned: success returned: success
type: dict type: str
description: description:
description: description:
- An optional description of this resource. Provide this property when you create - An optional description of this resource. Provide this property when you create
@ -139,7 +139,7 @@ items:
the pathRules defined by this PathMatcher is matched by the URL's path the pathRules defined by this PathMatcher is matched by the URL's path
portion. portion.
returned: success returned: success
type: dict type: str
description: description:
description: description:
- An optional description of this resource. - An optional description of this resource.
@ -168,7 +168,7 @@ items:
description: description:
- A reference to the BackendService resource if this rule is matched. - A reference to the BackendService resource if this rule is matched.
returned: success returned: success
type: dict type: str
tests: tests:
description: description:
- The list of expected URL mappings. Requests to update this UrlMap will succeed - The list of expected URL mappings. Requests to update this UrlMap will succeed
@ -196,7 +196,7 @@ items:
- A reference to expected BackendService resource the given URL should be - A reference to expected BackendService resource the given URL should be
mapped to. mapped to.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################

View file

@ -64,19 +64,18 @@ options:
description: description:
- URL of the Target VPN gateway with which this VPN tunnel is associated. - URL of the Target VPN gateway with which this VPN tunnel is associated.
- 'This field represents a link to a TargetVpnGateway resource in GCP. It can - 'This field represents a link to a TargetVpnGateway resource in GCP. It can
be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway be specified in two ways. First, you can place in the selfLink of the resource
task and then set this target_vpn_gateway field to "{{ name-of-resource }}" here as a string Alternatively, you can add `register: name-of-resource` to
Alternatively, you can set this target_vpn_gateway to a dictionary with the a gcp_compute_target_vpn_gateway task and then set this target_vpn_gateway field
selfLink key where the value is the selfLink of your TargetVpnGateway' to "{{ name-of-resource }}"'
required: true required: true
router: router:
description: description:
- URL of router resource to be used for dynamic routing. - URL of router resource to be used for dynamic routing.
- 'This field represents a link to a Router resource in GCP. It can be specified - 'This field represents a link to a Router resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_compute_router in two ways. First, you can place in the selfLink of the resource here as a
task and then set this router field to "{{ name-of-resource }}" Alternatively, string Alternatively, you can add `register: name-of-resource` to a gcp_compute_router
you can set this router to a dictionary with the selfLink key where the value task and then set this router field to "{{ name-of-resource }}"'
is the selfLink of your Router'
required: false required: false
peer_ip: peer_ip:
description: description:
@ -125,7 +124,7 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-vpn_tunnel" name: "network-vpn-tunnel"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
@ -134,7 +133,7 @@ EXAMPLES = '''
- name: create a router - name: create a router
gcp_compute_router: gcp_compute_router:
name: "router-vpn_tunnel" name: "router-vpn-tunnel"
network: "{{ network }}" network: "{{ network }}"
bgp: bgp:
asn: 64514 asn: 64514
@ -153,7 +152,7 @@ EXAMPLES = '''
- name: create a target vpn gateway - name: create a target vpn gateway
gcp_compute_target_vpn_gateway: gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel" name: "gateway-vpn-tunnel"
region: us-west1 region: us-west1
network: "{{ network }}" network: "{{ network }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
@ -199,12 +198,12 @@ targetVpnGateway:
description: description:
- URL of the Target VPN gateway with which this VPN tunnel is associated. - URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success returned: success
type: dict type: str
router: router:
description: description:
- URL of router resource to be used for dynamic routing. - URL of router resource to be used for dynamic routing.
returned: success returned: success
type: dict type: str
peerIp: peerIp:
description: description:
- IP address of the peer VPN gateway. Only IPv4 is supported. - IP address of the peer VPN gateway. Only IPv4 is supported.
@ -282,8 +281,8 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
description=dict(type='str'), description=dict(type='str'),
target_vpn_gateway=dict(required=True, type='dict'), target_vpn_gateway=dict(required=True),
router=dict(type='dict'), router=dict(),
peer_ip=dict(required=True, type='str'), peer_ip=dict(required=True, type='str'),
shared_secret=dict(required=True, type='str'), shared_secret=dict(required=True, type='str'),
ike_version=dict(default=2, type='int'), ike_version=dict(default=2, type='int'),

View file

@ -93,12 +93,12 @@ items:
description: description:
- URL of the Target VPN gateway with which this VPN tunnel is associated. - URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success returned: success
type: dict type: str
router: router:
description: description:
- URL of router resource to be used for dynamic routing. - URL of router resource to be used for dynamic routing.
returned: success returned: success
type: dict type: str
peerIp: peerIp:
description: description:
- IP address of the peer VPN gateway. Only IPv4 is supported. - IP address of the peer VPN gateway. Only IPv4 is supported.

View file

@ -153,7 +153,7 @@ options:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
required: false required: false
type: bool type: bool
master_auth: master_auth:
@ -210,8 +210,6 @@ options:
description: description:
- The name of the Google Compute Engine network to which the cluster is connected. - The name of the Google Compute Engine network to which the cluster is connected.
If left unspecified, the default network will be used. If left unspecified, the default network will be used.
- To ensure it exists and it is operations, configure the network using 'gcompute_network'
resource.
required: false required: false
cluster_ipv4_cidr: cluster_ipv4_cidr:
description: description:
@ -403,7 +401,7 @@ nodeConfig:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
returned: success returned: success
type: bool type: bool
masterAuth: masterAuth:
@ -462,8 +460,6 @@ network:
description: description:
- The name of the Google Compute Engine network to which the cluster is connected. - The name of the Google Compute Engine network to which the cluster is connected.
If left unspecified, the default network will be used. If left unspecified, the default network will be used.
- To ensure it exists and it is operations, configure the network using 'gcompute_network'
resource.
returned: success returned: success
type: str type: str
clusterIpv4Cidr: clusterIpv4Cidr:

View file

@ -181,7 +181,7 @@ items:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
returned: success returned: success
type: bool type: bool
masterAuth: masterAuth:
@ -240,8 +240,6 @@ items:
description: description:
- The name of the Google Compute Engine network to which the cluster is connected. - The name of the Google Compute Engine network to which the cluster is connected.
If left unspecified, the default network will be used. If left unspecified, the default network will be used.
- To ensure it exists and it is operations, configure the network using 'gcompute_network'
resource.
returned: success returned: success
type: str type: str
clusterIpv4Cidr: clusterIpv4Cidr:

View file

@ -136,7 +136,7 @@ options:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
required: false required: false
type: bool type: bool
initial_node_count: initial_node_count:
@ -204,10 +204,9 @@ options:
description: description:
- The cluster this node pool belongs to. - The cluster this node pool belongs to.
- 'This field represents a link to a Cluster resource in GCP. It can be specified - 'This field represents a link to a Cluster resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_container_cluster in two ways. First, you can place in the name of the resource here as a string
task and then set this cluster field to "{{ name-of-resource }}" Alternatively, Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
you can set this cluster to a dictionary with the name key where the value is task and then set this cluster field to "{{ name-of-resource }}"'
the name of your Cluster'
required: true required: true
zone: zone:
description: description:
@ -336,7 +335,7 @@ config:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
returned: success returned: success
type: bool type: bool
initialNodeCount: initialNodeCount:
@ -416,7 +415,7 @@ cluster:
description: description:
- The cluster this node pool belongs to. - The cluster this node pool belongs to.
returned: success returned: success
type: dict type: str
zone: zone:
description: description:
- The zone where the node pool is deployed. - The zone where the node pool is deployed.
@ -470,7 +469,7 @@ def main():
description=dict(type='str') description=dict(type='str')
)) ))
)), )),
cluster=dict(required=True, type='dict'), cluster=dict(required=True),
zone=dict(required=True, type='str') zone=dict(required=True, type='str')
) )
) )

View file

@ -49,10 +49,9 @@ options:
description: description:
- The cluster this node pool belongs to. - The cluster this node pool belongs to.
- 'This field represents a link to a Cluster resource in GCP. It can be specified - 'This field represents a link to a Cluster resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_container_cluster in two ways. First, you can place in the name of the resource here as a string
task and then set this cluster field to "{{ name-of-resource }}" Alternatively, Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
you can set this cluster to a dictionary with the name key where the value is task and then set this cluster field to "{{ name-of-resource }}"'
the name of your Cluster'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -168,7 +167,7 @@ items:
preemptible: preemptible:
description: description:
- 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible) - 'Whether the nodes are created as preemptible VM instances. See: U(https://cloud.google.com/compute/docs/instances/preemptible)
for more inforamtion about preemptible VM instances.' for more information about preemptible VM instances.'
returned: success returned: success
type: bool type: bool
initialNodeCount: initialNodeCount:
@ -249,7 +248,7 @@ items:
description: description:
- The cluster this node pool belongs to. - The cluster this node pool belongs to.
returned: success returned: success
type: dict type: str
zone: zone:
description: description:
- The zone where the node pool is deployed. - The zone where the node pool is deployed.
@ -272,7 +271,7 @@ def main():
module = GcpModule( module = GcpModule(
argument_spec=dict( argument_spec=dict(
zone=dict(required=True, type='str'), zone=dict(required=True, type='str'),
cluster=dict(required=True, type='dict') cluster=dict(required=True)
) )
) )

View file

@ -86,10 +86,9 @@ options:
- Identifies the managed zone addressed by this request. - Identifies the managed zone addressed by this request.
- Can be the managed zone name or id. - Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified - 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone in two ways. First, you can place in the name of the resource here as a string
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone
you can set this managed_zone to a dictionary with the name key where the value task and then set this managed_zone field to "{{ name-of-resource }}"'
is the name of your ManagedZone'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -147,7 +146,7 @@ managed_zone:
- Identifies the managed zone addressed by this request. - Identifies the managed zone addressed by this request.
- Can be the managed zone name or id. - Can be the managed zone name or id.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################
@ -175,7 +174,7 @@ def main():
type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']), type=dict(required=True, type='str', choices=['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NAPTR', 'NS', 'PTR', 'SOA', 'SPF', 'SRV', 'TXT']),
ttl=dict(type='int'), ttl=dict(type='int'),
target=dict(type='list', elements='str'), target=dict(type='list', elements='str'),
managed_zone=dict(required=True, type='dict') managed_zone=dict(required=True)
) )
) )

View file

@ -46,10 +46,9 @@ options:
- Identifies the managed zone addressed by this request. - Identifies the managed zone addressed by this request.
- Can be the managed zone name or id. - Can be the managed zone name or id.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified - 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_dns_managed_zone in two ways. First, you can place in the name of the resource here as a string
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively, Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone
you can set this managed_zone to a dictionary with the name key where the value task and then set this managed_zone field to "{{ name-of-resource }}"'
is the name of your ManagedZone'
required: true required: true
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -94,7 +93,7 @@ items:
- Identifies the managed zone addressed by this request. - Identifies the managed zone addressed by this request.
- Can be the managed zone name or id. - Can be the managed zone name or id.
returned: success returned: success
type: dict type: str
''' '''
################################################################################ ################################################################################
@ -111,7 +110,7 @@ import json
def main(): def main():
module = GcpModule( module = GcpModule(
argument_spec=dict( argument_spec=dict(
managed_zone=dict(required=True, type='dict') managed_zone=dict(required=True)
) )
) )

View file

@ -57,10 +57,9 @@ options:
description: description:
- A reference to a Topic resource. - A reference to a Topic resource.
- 'This field represents a link to a Topic resource in GCP. It can be specified - 'This field represents a link to a Topic resource in GCP. It can be specified
in two ways. You can add `register: name-of-resource` to a gcp_pubsub_topic in two ways. First, you can place in the name of the resource here as a string
task and then set this topic field to "{{ name-of-resource }}" Alternatively, Alternatively, you can add `register: name-of-resource` to a gcp_pubsub_topic
you can set this topic to a dictionary with the name key where the value is task and then set this topic field to "{{ name-of-resource }}"'
the name of your Topic'
required: false required: false
push_config: push_config:
description: description:
@ -108,8 +107,6 @@ EXAMPLES = '''
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "test_object" name: "test_object"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "test_project" project: "test_project"
auth_kind: "serviceaccount" auth_kind: "serviceaccount"
@ -127,7 +124,7 @@ topic:
description: description:
- A reference to a Topic resource. - A reference to a Topic resource.
returned: success returned: success
type: dict type: str
pushConfig: pushConfig:
description: description:
- If push delivery is used with this subscription, this field is used to configure - If push delivery is used with this subscription, this field is used to configure
@ -181,7 +178,7 @@ def main():
argument_spec=dict( argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(type='str'), name=dict(type='str'),
topic=dict(type='dict'), topic=dict(),
push_config=dict(type='dict', options=dict( push_config=dict(type='dict', options=dict(
push_endpoint=dict(type='str') push_endpoint=dict(type='str')
)), )),

View file

@ -197,6 +197,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 ssl certificate - name: delete a ssl certificate
gcp_compute_ssl_certificate: gcp_compute_ssl_certificate:
name: "sslcert-targethttpsproxy" name: "sslcert-targethttpsproxy"
@ -230,6 +231,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: sslcert register: sslcert
ignore_errors: true
- name: delete a url map - name: delete a url map
gcp_compute_url_map: gcp_compute_url_map:
name: "urlmap-targethttpsproxy" name: "urlmap-targethttpsproxy"
@ -239,6 +241,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-targethttpsproxy" name: "backendservice-targethttpsproxy"
@ -252,6 +255,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-targethttpsproxy" name: "httphealthcheck-targethttpsproxy"
@ -264,6 +268,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-targethttpsproxy" name: "instancegroup-targethttpsproxy"
@ -273,3 +278,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

@ -192,6 +192,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 ssl certificate - name: delete a ssl certificate
gcp_compute_ssl_certificate: gcp_compute_ssl_certificate:
name: "sslcert-targetsslproxy" name: "sslcert-targetsslproxy"
@ -225,6 +226,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: sslcert register: sslcert
ignore_errors: true
- name: delete a backend service - name: delete a backend service
gcp_compute_backend_service: gcp_compute_backend_service:
name: "backendservice-targetsslproxy" name: "backendservice-targetsslproxy"
@ -238,6 +240,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 health check - name: delete a health check
gcp_compute_health_check: gcp_compute_health_check:
name: "healthcheck-targetsslproxy" name: "healthcheck-targetsslproxy"
@ -254,6 +257,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-targetsslproxy" name: "instancegroup-targetsslproxy"
@ -263,3 +267,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

@ -154,6 +154,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 backend service - name: delete a backend service
gcp_compute_backend_service: gcp_compute_backend_service:
name: "backendservice-targettcpproxy" name: "backendservice-targettcpproxy"
@ -167,6 +168,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 health check - name: delete a health check
gcp_compute_health_check: gcp_compute_health_check:
name: "healthcheck-targettcpproxy" name: "healthcheck-targettcpproxy"
@ -183,6 +185,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-targettcpproxy" name: "instancegroup-targettcpproxy"
@ -192,3 +195,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

@ -135,6 +135,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 network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-vpngateway" name: "network-vpngateway"
@ -143,6 +144,7 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true
- name: delete a address - name: delete a address
gcp_compute_address: gcp_compute_address:
name: "address-vpngateway" name: "address-vpngateway"
@ -152,3 +154,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

@ -145,6 +145,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 backend service - name: delete a backend service
gcp_compute_backend_service: gcp_compute_backend_service:
name: "backendservice-urlmap" name: "backendservice-urlmap"
@ -158,6 +159,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-urlmap" name: "httphealthcheck-urlmap"
@ -170,6 +172,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-urlmap" name: "instancegroup-urlmap"
@ -179,3 +182,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

@ -15,7 +15,7 @@
# Pre-test setup # Pre-test setup
- name: create a network - name: create a network
gcp_compute_network: gcp_compute_network:
name: "network-vpn_tunnel" name: "network-vpn-tunnel"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
@ -23,7 +23,7 @@
register: network register: network
- name: create a router - name: create a router
gcp_compute_router: gcp_compute_router:
name: "router-vpn_tunnel" name: "router-vpn-tunnel"
network: "{{ network }}" network: "{{ network }}"
bgp: bgp:
asn: 64514 asn: 64514
@ -41,7 +41,7 @@
register: router register: router
- name: create a target vpn gateway - name: create a target vpn gateway
gcp_compute_target_vpn_gateway: gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel" name: "gateway-vpn-tunnel"
region: us-west1 region: us-west1
network: "{{ network }}" network: "{{ network }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
@ -164,9 +164,10 @@
- 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 vpn gateway - name: delete a target vpn gateway
gcp_compute_target_vpn_gateway: gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel" name: "gateway-vpn-tunnel"
region: us-west1 region: us-west1
network: "{{ network }}" network: "{{ network }}"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
@ -174,9 +175,10 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: gateway register: gateway
ignore_errors: true
- name: delete a router - name: delete a router
gcp_compute_router: gcp_compute_router:
name: "router-vpn_tunnel" name: "router-vpn-tunnel"
network: "{{ network }}" network: "{{ network }}"
bgp: bgp:
asn: 64514 asn: 64514
@ -192,11 +194,13 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: router register: router
ignore_errors: true
- name: delete a network - name: delete a network
gcp_compute_network: gcp_compute_network:
name: "network-vpn_tunnel" name: "network-vpn-tunnel"
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: network register: network
ignore_errors: true

View file

@ -15,7 +15,7 @@
# Pre-test setup # Pre-test setup
- name: delete a cluster - name: delete a cluster
gcp_container_cluster: gcp_container_cluster:
name: "{{ resource_name }}" name: my-cluster
initial_node_count: 2 initial_node_count: 2
master_auth: master_auth:
username: cluster_admin username: cluster_admin
@ -31,7 +31,7 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a cluster - name: create a cluster
gcp_container_cluster: gcp_container_cluster:
name: "{{ resource_name }}" name: my-cluster
initial_node_count: 2 initial_node_count: 2
master_auth: master_auth:
username: cluster_admin username: cluster_admin
@ -50,17 +50,22 @@
that: that:
- result.changed == true - result.changed == true
- name: verify that cluster was created - name: verify that cluster was created
shell: | gcp_container_cluster_facts:
gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results register: results
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results.rc == 0 - "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a cluster that already exists - name: create a cluster that already exists
gcp_container_cluster: gcp_container_cluster:
name: "{{ resource_name }}" name: my-cluster
initial_node_count: 2 initial_node_count: 2
master_auth: master_auth:
username: cluster_admin username: cluster_admin
@ -81,7 +86,7 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a cluster - name: delete a cluster
gcp_container_cluster: gcp_container_cluster:
name: "{{ resource_name }}" name: my-cluster
initial_node_count: 2 initial_node_count: 2
master_auth: master_auth:
username: cluster_admin username: cluster_admin
@ -100,19 +105,22 @@
that: that:
- result.changed == true - result.changed == true
- name: verify that cluster was deleted - name: verify that cluster was deleted
shell: | gcp_container_cluster_facts:
gcloud container clusters describe --project="{{ gcp_project}}" --zone=us-central1-a "{{ resource_name }}" zone: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results register: results
failed_when: results.rc == 0
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results.rc == 1 - "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\""
- "\"No cluster named '{{ resource_name }}' in {{ gcp_project }}.\" in results.stderr"
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a cluster that does not exist - name: delete a cluster that does not exist
gcp_container_cluster: gcp_container_cluster:
name: "{{ resource_name }}" name: my-cluster
initial_node_count: 2 initial_node_count: 2
master_auth: master_auth:
username: cluster_admin username: cluster_admin

View file

@ -25,7 +25,7 @@
register: cluster register: cluster
- name: delete a node pool - name: delete a node pool
gcp_container_node_pool: gcp_container_node_pool:
name: "{{ resource_name }}" name: my-pool
initial_node_count: 4 initial_node_count: 4
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
@ -36,7 +36,7 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a node pool - name: create a node pool
gcp_container_node_pool: gcp_container_node_pool:
name: "{{ resource_name }}" name: my-pool
initial_node_count: 4 initial_node_count: 4
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
@ -51,8 +51,6 @@
- result.changed == true - result.changed == true
- name: verify that node_pool was created - name: verify that node_pool was created
gcp_container_node_pool_facts: gcp_container_node_pool_facts:
filters:
- name = {{ resource_name }}
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
@ -64,11 +62,11 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length == 1 - "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a node pool that already exists - name: create a node pool that already exists
gcp_container_node_pool: gcp_container_node_pool:
name: "{{ resource_name }}" name: my-pool
initial_node_count: 4 initial_node_count: 4
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
@ -84,7 +82,7 @@
#---------------------------------------------------------- #----------------------------------------------------------
- name: delete a node pool - name: delete a node pool
gcp_container_node_pool: gcp_container_node_pool:
name: "{{ resource_name }}" name: my-pool
initial_node_count: 4 initial_node_count: 4
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
@ -99,8 +97,6 @@
- result.changed == true - result.changed == true
- name: verify that node_pool was deleted - name: verify that node_pool was deleted
gcp_container_node_pool_facts: gcp_container_node_pool_facts:
filters:
- name = {{ resource_name }}
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
@ -112,11 +108,11 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length == 0 - "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a node pool that does not exist - name: delete a node pool that does not exist
gcp_container_node_pool: gcp_container_node_pool:
name: "{{ resource_name }}" name: my-pool
initial_node_count: 4 initial_node_count: 4
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
zone: us-central1-a zone: us-central1-a
@ -131,6 +127,7 @@
- result.changed == false - result.changed == false
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a cluster - name: delete a cluster
gcp_container_cluster: gcp_container_cluster:
name: "cluster-nodepool" name: "cluster-nodepool"
@ -141,3 +138,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: cluster register: cluster
ignore_errors: true

View file

@ -68,7 +68,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length >= 2 - "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a resource record set that already exists - name: create a resource record set that already exists
gcp_dns_resource_record_set: gcp_dns_resource_record_set:
@ -121,7 +121,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length >= 2 - "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a resource record set that does not exist - name: delete a resource record set that does not exist
gcp_dns_resource_record_set: gcp_dns_resource_record_set:
@ -144,6 +144,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 managed zone - name: delete a managed zone
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "managedzone-rrs" name: "managedzone-rrs"
@ -154,3 +155,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: managed_zone register: managed_zone
ignore_errors: true

View file

@ -25,8 +25,6 @@
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "{{ resource_name }}" name: "{{ resource_name }}"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
@ -37,8 +35,6 @@
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "{{ resource_name }}" name: "{{ resource_name }}"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
@ -60,14 +56,12 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length == 1 - "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a subscription that already exists - name: create a subscription that already exists
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "{{ resource_name }}" name: "{{ resource_name }}"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
@ -83,8 +77,6 @@
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "{{ resource_name }}" name: "{{ resource_name }}"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
@ -106,14 +98,12 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- results['items'] | length == 0 - "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a subscription that does not exist - name: delete a subscription that does not exist
gcp_pubsub_subscription: gcp_pubsub_subscription:
name: "{{ resource_name }}" name: "{{ resource_name }}"
topic: "{{ topic }}" topic: "{{ topic }}"
push_config:
push_endpoint: https://myapp.graphite.cloudnativeapp.com/webhook/sub1
ack_deadline_seconds: 300 ack_deadline_seconds: 300
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
@ -126,6 +116,7 @@
- result.changed == false - result.changed == false
#--------------------------------------------------------- #---------------------------------------------------------
# Post-test teardown # Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a topic - name: delete a topic
gcp_pubsub_topic: gcp_pubsub_topic:
name: "topic-subscription" name: "topic-subscription"
@ -134,3 +125,4 @@
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
state: absent state: absent
register: topic register: topic
ignore_errors: true