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
BackendService.
returned: success
type: dict
type: str
'''
################################################################################

View file

@ -81,15 +81,25 @@ options:
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
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:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
- '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
task and then set this url_map field to "{{ name-of-resource }}" Alternatively,
you can set this url_map to a dictionary with the selfLink key where the value
is the selfLink of your UrlMap'
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_url_map
task and then set this url_map field to "{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
notes:
@ -232,11 +242,18 @@ sslCertificates:
users and the load balancer. Currently, exactly one SSL certificate must be specified.
returned: success
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:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the BackendService.
returned: success
type: dict
type: str
'''
################################################################################
@ -261,8 +278,9 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
quic_override=dict(type='str', choices=['NONE', 'ENABLE', 'DISABLE']),
ssl_certificates=dict(required=True, type='list', elements='dict'),
url_map=dict(required=True, type='dict')
ssl_certificates=dict(required=True, type='list'),
ssl_policy=dict(),
url_map=dict(required=True)
)
)
@ -313,6 +331,8 @@ def update_fields(module, request, response):
quic_override_update(module, request, response)
if response.get('sslCertificates') != request.get('sslCertificates'):
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'):
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):
auth = GcpSession(module, 'compute')
auth.post(
@ -368,6 +401,7 @@ def resource_to_request(module):
u'name': module.params.get('name'),
u'quicOverride': module.params.get('quic_override'),
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')
}
return_vals = {}
@ -440,6 +474,7 @@ def response_to_hash(module, response):
u'name': module.params.get('name'),
u'quicOverride': response.get(u'quicOverride'),
u'sslCertificates': response.get(u'sslCertificates'),
u'sslPolicy': response.get(u'sslPolicy'),
u'urlMap': response.get(u'urlMap')
}

View file

@ -106,12 +106,19 @@ items:
must be specified.
returned: success
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:
description:
- A reference to the UrlMap resource that defines the mapping from URL to the
BackendService.
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
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
in two ways. You can add `register: name-of-resource` to a gcp_compute_target_pool
task and then set this backup_pool field to "{{ name-of-resource }}" Alternatively,
you can set this backup_pool to a dictionary with the selfLink key where the
value is the selfLink of your TargetPool'
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_target_pool
task and then set this backup_pool field to "{{ name-of-resource }}"'
required: false
description:
description:
@ -92,10 +91,10 @@ options:
checks pass. If not specified it means all member instances will be considered
healthy at all times.
- '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
task and then set this health_check field to "{{ name-of-resource }}" Alternatively,
you can set this health_check to a dictionary with the selfLink key where the
value is the selfLink of your HttpHealthCheck'
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_http_health_check task and then set this health_check field to
"{{ name-of-resource }}"'
required: false
instances:
description:
@ -160,7 +159,7 @@ backupPool:
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.
returned: success
type: dict
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
@ -193,7 +192,7 @@ healthCheck:
checks pass. If not specified it means all member instances will be considered
healthy at all times.
returned: success
type: dict
type: str
id:
description:
- The unique identifier for the resource.
@ -251,11 +250,11 @@ def main():
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
backup_pool=dict(type='dict'),
backup_pool=dict(),
description=dict(type='str'),
failover_ratio=dict(type='str'),
health_check=dict(type='dict'),
instances=dict(type='list', elements='dict'),
health_check=dict(),
instances=dict(type='list'),
name=dict(required=True, type='str'),
session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'CLIENT_IP_PROTO']),
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
instances with the best effort, or to all instances when no instance is healthy.
returned: success
type: dict
type: str
creationTimestamp:
description:
- Creation timestamp in RFC3339 text format.
@ -117,7 +117,7 @@ items:
checks pass. If not specified it means all member instances will be considered
healthy at all times.
returned: success
type: dict
type: str
id:
description:
- The unique identifier for the resource.

View file

@ -74,10 +74,10 @@ options:
description:
- A reference to the BackendService resource.
- '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
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value
is the selfLink of your BackendService'
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_backend_service task and then set this service field to "{{ name-of-resource
}}"'
required: true
ssl_certificates:
description:
@ -85,6 +85,17 @@ options:
between users and the load balancer. Currently, exactly one SSL certificate
must be specified.
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
notes:
- 'API Reference: U(https://cloud.google.com/compute/docs/reference/latest/targetSslProxies)'
@ -215,13 +226,20 @@ service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
type: str
sslCertificates:
description:
- 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.
returned: success
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'),
name=dict(required=True, type='str'),
proxy_header=dict(type='str', choices=['NONE', 'PROXY_V1']),
service=dict(required=True, type='dict'),
ssl_certificates=dict(required=True, type='list', elements='dict')
service=dict(required=True),
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)
if response.get('sslCertificates') != request.get('sslCertificates'):
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):
@ -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):
auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.delete(link))
@ -353,7 +387,8 @@ def resource_to_request(module):
u'name': module.params.get('name'),
u'proxyHeader': module.params.get('proxy_header'),
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 = {}
for k, v in request.items():
@ -425,7 +460,8 @@ def response_to_hash(module, response):
u'name': module.params.get('name'),
u'proxyHeader': response.get(u'proxyHeader'),
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:
- A reference to the BackendService resource.
returned: success
type: dict
type: str
sslCertificates:
description:
- A list of SslCertificate resources that are used to authenticate connections
@ -108,6 +108,13 @@ items:
must be specified.
returned: success
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:
- A reference to the BackendService resource.
- '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
task and then set this service field to "{{ name-of-resource }}" Alternatively,
you can set this service to a dictionary with the selfLink key where the value
is the selfLink of your BackendService'
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_backend_service task and then set this service field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
notes:
@ -174,7 +174,7 @@ service:
description:
- A reference to the BackendService resource.
returned: success
type: dict
type: str
'''
################################################################################
@ -199,7 +199,7 @@ def main():
description=dict(type='str'),
name=dict(required=True, type='str'),
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:
- A reference to the BackendService resource.
returned: success
type: dict
type: str
'''
################################################################################

View file

@ -66,10 +66,9 @@ options:
description:
- The network this VPN gateway is accepting traffic for.
- '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
task and then set this network field to "{{ name-of-resource }}" Alternatively,
you can set this network to a dictionary with the selfLink key where the value
is the selfLink of your Network'
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_network
task and then set this network field to "{{ name-of-resource }}"'
required: true
region:
description:
@ -141,15 +140,16 @@ network:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
type: str
tunnels:
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
type: list
forwardingRules:
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
type: list
region:
@ -180,7 +180,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'),
description=dict(type='str'),
name=dict(required=True, type='str'),
network=dict(required=True, type='dict'),
network=dict(required=True),
region=dict(required=True, type='str')
)
)

View file

@ -99,16 +99,16 @@ items:
description:
- The network this VPN gateway is accepting traffic for.
returned: success
type: dict
type: str
tunnels:
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
type: list
forwardingRules:
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
type: list
region:

View file

@ -53,10 +53,10 @@ options:
description:
- 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
specified in two ways. You can add `register: name-of-resource` to a gcp_compute_backend_service
task and then set this default_service field to "{{ name-of-resource }}" Alternatively,
you can set this default_service to a dictionary with the selfLink key where
the value is the selfLink of your BackendService'
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_backend_service task and then set this default_service field to
"{{ name-of-resource }}"'
required: true
description:
description:
@ -103,11 +103,10 @@ options:
- 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.
- '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 task and then set this default_service field
to "{{ name-of-resource }}" Alternatively, you can set this default_service
to a dictionary with the selfLink key where the value is the selfLink of
your BackendService'
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_backend_service task and then set this default_service
field to "{{ name-of-resource }}"'
required: true
description:
description:
@ -133,11 +132,10 @@ options:
description:
- A reference to the BackendService resource if this rule is matched.
- '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 task and then set this service field
to "{{ name-of-resource }}" Alternatively, you can set this service
to a dictionary with the selfLink key where the value is the selfLink
of your BackendService'
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_backend_service task and then set
this service field to "{{ name-of-resource }}"'
required: true
tests:
description:
@ -162,10 +160,10 @@ options:
- A reference to expected BackendService resource the given URL should be
mapped to.
- '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 task and then set this service field to "{{
name-of-resource }}" Alternatively, you can set this service to a dictionary
with the selfLink key where the value is the selfLink of your BackendService'
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_backend_service task and then set this service field to
"{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
'''
@ -228,7 +226,7 @@ defaultService:
description:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
type: str
description:
description:
- 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
pathRules defined by this PathMatcher is matched by the URL's path portion.
returned: success
type: dict
type: str
description:
description:
- An optional description of this resource.
@ -321,7 +319,7 @@ pathMatchers:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
type: str
tests:
description:
- 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
to.
returned: success
type: dict
type: str
'''
################################################################################
@ -371,7 +369,7 @@ def main():
module = GcpModule(
argument_spec=dict(
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'),
host_rules=dict(type='list', elements='dict', options=dict(
description=dict(type='str'),
@ -380,19 +378,19 @@ def main():
)),
name=dict(required=True, type='str'),
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'),
name=dict(required=True, type='str'),
path_rules=dict(type='list', elements='dict', options=dict(
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(
description=dict(type='str'),
host=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:
- A reference to BackendService resource if none of the hostRules match.
returned: success
type: dict
type: str
description:
description:
- 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
portion.
returned: success
type: dict
type: str
description:
description:
- An optional description of this resource.
@ -168,7 +168,7 @@ items:
description:
- A reference to the BackendService resource if this rule is matched.
returned: success
type: dict
type: str
tests:
description:
- 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
mapped to.
returned: success
type: dict
type: str
'''
################################################################################

View file

@ -64,19 +64,18 @@ options:
description:
- 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
be specified in two ways. You can add `register: name-of-resource` to a gcp_compute_target_vpn_gateway
task and then set this target_vpn_gateway field to "{{ name-of-resource }}"
Alternatively, you can set this target_vpn_gateway to a dictionary with the
selfLink key where the value is the selfLink of your TargetVpnGateway'
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_target_vpn_gateway task and then set this target_vpn_gateway field
to "{{ name-of-resource }}"'
required: true
router:
description:
- 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
in two ways. You can add `register: name-of-resource` to a gcp_compute_router
task and then set this router field to "{{ name-of-resource }}" Alternatively,
you can set this router to a dictionary with the selfLink key where the value
is the selfLink of your Router'
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_router
task and then set this router field to "{{ name-of-resource }}"'
required: false
peer_ip:
description:
@ -125,7 +124,7 @@ notes:
EXAMPLES = '''
- name: create a network
gcp_compute_network:
name: "network-vpn_tunnel"
name: "network-vpn-tunnel"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -134,7 +133,7 @@ EXAMPLES = '''
- name: create a router
gcp_compute_router:
name: "router-vpn_tunnel"
name: "router-vpn-tunnel"
network: "{{ network }}"
bgp:
asn: 64514
@ -153,7 +152,7 @@ EXAMPLES = '''
- name: create a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel"
name: "gateway-vpn-tunnel"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
@ -199,12 +198,12 @@ targetVpnGateway:
description:
- URL of the Target VPN gateway with which this VPN tunnel is associated.
returned: success
type: dict
type: str
router:
description:
- URL of router resource to be used for dynamic routing.
returned: success
type: dict
type: str
peerIp:
description:
- 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'),
name=dict(required=True, type='str'),
description=dict(type='str'),
target_vpn_gateway=dict(required=True, type='dict'),
router=dict(type='dict'),
target_vpn_gateway=dict(required=True),
router=dict(),
peer_ip=dict(required=True, type='str'),
shared_secret=dict(required=True, type='str'),
ike_version=dict(default=2, type='int'),

View file

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

View file

@ -153,7 +153,7 @@ options:
preemptible:
description:
- '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
type: bool
master_auth:
@ -210,8 +210,6 @@ options:
description:
- The name of the Google Compute Engine network to which the cluster is connected.
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
cluster_ipv4_cidr:
description:
@ -403,7 +401,7 @@ nodeConfig:
preemptible:
description:
- '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
type: bool
masterAuth:
@ -462,8 +460,6 @@ network:
description:
- The name of the Google Compute Engine network to which the cluster is connected.
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
type: str
clusterIpv4Cidr:

View file

@ -181,7 +181,7 @@ items:
preemptible:
description:
- '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
type: bool
masterAuth:
@ -240,8 +240,6 @@ items:
description:
- The name of the Google Compute Engine network to which the cluster is connected.
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
type: str
clusterIpv4Cidr:

View file

@ -136,7 +136,7 @@ options:
preemptible:
description:
- '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
type: bool
initial_node_count:
@ -204,10 +204,9 @@ options:
description:
- The cluster this node pool belongs to.
- '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
task and then set this cluster field to "{{ name-of-resource }}" Alternatively,
you can set this cluster to a dictionary with the name key where the value is
the name of your Cluster'
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
task and then set this cluster field to "{{ name-of-resource }}"'
required: true
zone:
description:
@ -336,7 +335,7 @@ config:
preemptible:
description:
- '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
type: bool
initialNodeCount:
@ -416,7 +415,7 @@ cluster:
description:
- The cluster this node pool belongs to.
returned: success
type: dict
type: str
zone:
description:
- The zone where the node pool is deployed.
@ -470,7 +469,7 @@ def main():
description=dict(type='str')
))
)),
cluster=dict(required=True, type='dict'),
cluster=dict(required=True),
zone=dict(required=True, type='str')
)
)

View file

@ -49,10 +49,9 @@ options:
description:
- The cluster this node pool belongs to.
- '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
task and then set this cluster field to "{{ name-of-resource }}" Alternatively,
you can set this cluster to a dictionary with the name key where the value is
the name of your Cluster'
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
task and then set this cluster field to "{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
'''
@ -168,7 +167,7 @@ items:
preemptible:
description:
- '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
type: bool
initialNodeCount:
@ -249,7 +248,7 @@ items:
description:
- The cluster this node pool belongs to.
returned: success
type: dict
type: str
zone:
description:
- The zone where the node pool is deployed.
@ -272,7 +271,7 @@ def main():
module = GcpModule(
argument_spec=dict(
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.
- Can be the managed zone name or id.
- '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
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone'
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
'''
@ -147,7 +146,7 @@ managed_zone:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
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']),
ttl=dict(type='int'),
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.
- Can be the managed zone name or id.
- '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
task and then set this managed_zone field to "{{ name-of-resource }}" Alternatively,
you can set this managed_zone to a dictionary with the name key where the value
is the name of your ManagedZone'
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_dns_managed_zone
task and then set this managed_zone field to "{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
'''
@ -94,7 +93,7 @@ items:
- Identifies the managed zone addressed by this request.
- Can be the managed zone name or id.
returned: success
type: dict
type: str
'''
################################################################################
@ -111,7 +110,7 @@ import json
def main():
module = GcpModule(
argument_spec=dict(
managed_zone=dict(required=True, type='dict')
managed_zone=dict(required=True)
)
)

View file

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

View file

@ -197,6 +197,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a ssl certificate
gcp_compute_ssl_certificate:
name: "sslcert-targethttpsproxy"
@ -230,6 +231,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: sslcert
ignore_errors: true
- name: delete a url map
gcp_compute_url_map:
name: "urlmap-targethttpsproxy"
@ -239,6 +241,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: urlmap
ignore_errors: true
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-targethttpsproxy"
@ -252,6 +255,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-targethttpsproxy"
@ -264,6 +268,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-targethttpsproxy"
@ -273,3 +278,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -192,6 +192,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a ssl certificate
gcp_compute_ssl_certificate:
name: "sslcert-targetsslproxy"
@ -225,6 +226,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: sslcert
ignore_errors: true
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-targetsslproxy"
@ -238,6 +240,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a health check
gcp_compute_health_check:
name: "healthcheck-targetsslproxy"
@ -254,6 +257,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-targetsslproxy"
@ -263,3 +267,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -154,6 +154,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-targettcpproxy"
@ -167,6 +168,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a health check
gcp_compute_health_check:
name: "healthcheck-targettcpproxy"
@ -183,6 +185,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-targettcpproxy"
@ -192,3 +195,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -135,6 +135,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a network
gcp_compute_network:
name: "network-vpngateway"
@ -143,6 +144,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true
- name: delete a address
gcp_compute_address:
name: "address-vpngateway"
@ -152,3 +154,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: address
ignore_errors: true

View file

@ -145,6 +145,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a backend service
gcp_compute_backend_service:
name: "backendservice-urlmap"
@ -158,6 +159,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-urlmap"
@ -170,6 +172,7 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
gcp_compute_instance_group:
name: "instancegroup-urlmap"
@ -179,3 +182,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: instancegroup
ignore_errors: true

View file

@ -15,7 +15,7 @@
# Pre-test setup
- name: create a network
gcp_compute_network:
name: "network-vpn_tunnel"
name: "network-vpn-tunnel"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -23,7 +23,7 @@
register: network
- name: create a router
gcp_compute_router:
name: "router-vpn_tunnel"
name: "router-vpn-tunnel"
network: "{{ network }}"
bgp:
asn: 64514
@ -41,7 +41,7 @@
register: router
- name: create a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel"
name: "gateway-vpn-tunnel"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
@ -164,9 +164,10 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a target vpn gateway
gcp_compute_target_vpn_gateway:
name: "gateway-vpn_tunnel"
name: "gateway-vpn-tunnel"
region: us-west1
network: "{{ network }}"
project: "{{ gcp_project }}"
@ -174,9 +175,10 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: gateway
ignore_errors: true
- name: delete a router
gcp_compute_router:
name: "router-vpn_tunnel"
name: "router-vpn-tunnel"
network: "{{ network }}"
bgp:
asn: 64514
@ -192,11 +194,13 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: router
ignore_errors: true
- name: delete a network
gcp_compute_network:
name: "network-vpn_tunnel"
name: "network-vpn-tunnel"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: network
ignore_errors: true

View file

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

View file

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

View file

@ -68,7 +68,7 @@
- name: verify that command succeeded
assert:
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
gcp_dns_resource_record_set:
@ -121,7 +121,7 @@
- name: verify that command succeeded
assert:
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
gcp_dns_resource_record_set:
@ -144,6 +144,7 @@
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a managed zone
gcp_dns_managed_zone:
name: "managedzone-rrs"
@ -154,3 +155,4 @@
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: managed_zone
ignore_errors: true

View file

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