fix: upgrade ansible version, address test and lint errors

This commit is contained in:
Chris Hawk 2023-11-17 16:39:42 -08:00
commit 08ada5354d
216 changed files with 4394 additions and 4262 deletions

View file

@ -13,7 +13,7 @@
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: create a global address
- name: Create a global address
google.cloud.gcp_compute_global_address:
name: globaladdress-globalforwardingrule
project: "{{ gcp_project }}"
@ -21,7 +21,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: globaladdress
- name: create a instance group
- name: Create a instance group
google.cloud.gcp_compute_instance_group:
name: instancegroup-globalforwardingrule
zone: us-central1-a
@ -30,7 +30,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: instancegroup
- name: create a HTTP health check
- name: Create a HTTP health check
google.cloud.gcp_compute_http_health_check:
name: httphealthcheck-globalforwardingrule
healthy_threshold: 10
@ -42,20 +42,20 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: healthcheck
- name: create a backend service
- name: Create a backend service
google.cloud.gcp_compute_backend_service:
name: backendservice-globalforwardingrule
backends:
- group: "{{ instancegroup.selfLink }}"
- group: "{{ instancegroup.selfLink }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
- "{{ healthcheck.selfLink }}"
enable_cdn: "true"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: backendservice
- name: create a URL map
- name: Create a URL map
google.cloud.gcp_compute_url_map:
name: urlmap-globalforwardingrule
default_service: "{{ backendservice }}"
@ -64,7 +64,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: urlmap
- name: create a target HTTP proxy
- name: Create a target HTTP proxy
google.cloud.gcp_compute_target_http_proxy:
name: targethttpproxy-globalforwardingrule
url_map: "{{ urlmap }}"
@ -73,7 +73,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: httpproxy
- name: delete a global forwarding rule
- name: Delete a global forwarding rule
google.cloud.gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
@ -85,7 +85,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
#----------------------------------------------------------
- name: create a global forwarding rule
- name: Create a global forwarding rule
google.cloud.gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
@ -97,26 +97,26 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: result
- name: assert changed is true
assert:
- name: Assert changed is true
ansible.builtin.assert:
that:
- result.changed == true
- name: verify that global_forwarding_rule was created
- name: Verify that global_forwarding_rule was created
google.cloud.gcp_compute_global_forwarding_rule_info:
filters:
- name = {{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/compute
filters:
- name = {{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/compute
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | length == 1
# ----------------------------------------------------------------------------
- name: create a global forwarding rule that already exists
- name: Create a global forwarding rule that already exists
google.cloud.gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
@ -128,12 +128,12 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: present
register: result
- name: assert changed is false
assert:
- name: Assert changed is false
ansible.builtin.assert:
that:
- result.changed == false
#----------------------------------------------------------
- name: delete a global forwarding rule
- name: Delete a global forwarding rule
google.cloud.gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
@ -145,26 +145,26 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
register: result
- name: assert changed is true
assert:
- name: Assert changed is true
ansible.builtin.assert:
that:
- result.changed == true
- name: verify that global_forwarding_rule was deleted
- name: Verify that global_forwarding_rule was deleted
google.cloud.gcp_compute_global_forwarding_rule_info:
filters:
- name = {{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/compute
filters:
- name = {{ resource_name }}
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/compute
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | length == 0
# ----------------------------------------------------------------------------
- name: delete a global forwarding rule that does not exist
- name: Delete a global forwarding rule that does not exist
google.cloud.gcp_compute_global_forwarding_rule:
name: "{{ resource_name }}"
ip_address: "{{ globaladdress.address }}"
@ -176,14 +176,14 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
register: result
- name: assert changed is false
assert:
- name: Assert changed is false
ansible.builtin.assert:
that:
- result.changed == false
#---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!
- name: delete a target HTTP proxy
- name: Delete a target HTTP proxy
google.cloud.gcp_compute_target_http_proxy:
name: targethttpproxy-globalforwardingrule
url_map: "{{ urlmap }}"
@ -193,7 +193,7 @@
state: absent
register: httpproxy
ignore_errors: true
- name: delete a URL map
- name: Delete a URL map
google.cloud.gcp_compute_url_map:
name: urlmap-globalforwardingrule
default_service: "{{ backendservice }}"
@ -203,21 +203,21 @@
state: absent
register: urlmap
ignore_errors: true
- name: delete a backend service
- name: Delete a backend service
google.cloud.gcp_compute_backend_service:
name: backendservice-globalforwardingrule
backends:
- group: "{{ instancegroup.selfLink }}"
- group: "{{ instancegroup.selfLink }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: 'true'
- "{{ healthcheck.selfLink }}"
enable_cdn: "true"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
register: backendservice
ignore_errors: true
- name: delete a HTTP health check
- name: Delete a HTTP health check
google.cloud.gcp_compute_http_health_check:
name: httphealthcheck-globalforwardingrule
healthy_threshold: 10
@ -230,7 +230,7 @@
state: absent
register: healthcheck
ignore_errors: true
- name: delete a instance group
- name: Delete a instance group
google.cloud.gcp_compute_instance_group:
name: instancegroup-globalforwardingrule
zone: us-central1-a
@ -240,7 +240,7 @@
state: absent
register: instancegroup
ignore_errors: true
- name: delete a global address
- name: Delete a global address
google.cloud.gcp_compute_global_address:
name: globaladdress-globalforwardingrule
project: "{{ gcp_project }}"

View file

@ -1,2 +1,3 @@
---
- include_tasks: autogen.yml
- name: Generated tests
ansible.builtin.include_tasks: autogen.yml