diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index 7a558e0d9b..81df87fdd3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -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 ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 87bba07fd7..0cc6706f8e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -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') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index e486510e03..ab15ad25a3 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -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 ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index ddb94fccd2..237b90fd84 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -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') diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 47db627502..17ca81e270 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -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. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 44c7e6d2fe..8547cd9364 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -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') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index a1374d404a..193ae7982f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -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 ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 41dcf2a5dd..9614281fb0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -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) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index cf6ca10f8d..f29c7e7332 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -100,7 +100,7 @@ items: description: - A reference to the BackendService resource. returned: success - type: dict + type: str ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index 68721994a1..a9a9c9218e 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -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') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 2abbdcc6d4..b31ede95fb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -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: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index fb557206db..ddc027bcf9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -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) )) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 9c9d6c5f3c..a3125c71d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -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 ''' ################################################################################ diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index 53cf6505ca..b694fae62b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -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'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 0141d1a82f..d51235ecdf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -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. diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 4e71d4363e..c88addf0ef 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -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: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py index c9db24c02b..8dcca82665 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py @@ -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: diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index adaac831d5..a2c9fa3445 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -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') ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py index 343f7f8d3a..8f3eece3a6 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py @@ -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) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index fd933ed6aa..e57770486c 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -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) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py index f5fd0c37cf..7727f87b5a 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py @@ -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) ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py index fd9fbd221d..157bc3a722 100644 --- a/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py +++ b/lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py @@ -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') )), diff --git a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index f8d18634fb..7a50dc4304 100644 --- a/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 2b9f24154f..f2b14904a2 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 1a552a262d..e057e090a7 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index c97e3fe1f5..ed7d69449f 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index 3931d7cbec..6e4a16f5fc 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index ca5db7e2fa..7cdd3de88a 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 86e111d66f..21ab822561 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index c3dfcbceff..9047ac40f6 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index d9866d4f15..a0a63d0bf6 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -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 diff --git a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 6afc20203e..2b6607b12b 100644 --- a/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/test/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -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