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 network
- name: Create a network
google.cloud.gcp_compute_network:
name: network-instance
project: "{{ gcp_project }}"
@ -22,7 +22,7 @@
auto_create_subnetworks: true
state: present
register: network
- name: delete a instance
- name: Delete a instance
google.cloud.gcp_redis_instance:
name: instance37
tier: STANDARD_HA
@ -40,7 +40,7 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
#----------------------------------------------------------
- name: create a instance
- name: Create a instance
google.cloud.gcp_redis_instance:
name: instance37
tier: STANDARD_HA
@ -58,25 +58,25 @@
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 instance was created
- name: Verify that instance was created
google.cloud.gcp_redis_instance_info:
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: create a instance that already exists
- name: Create a instance that already exists
google.cloud.gcp_redis_instance:
name: instance37
tier: STANDARD_HA
@ -94,12 +94,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 instance
- name: Delete a instance
google.cloud.gcp_redis_instance:
name: instance37
tier: STANDARD_HA
@ -117,25 +117,25 @@
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 instance was deleted
- name: Verify that instance was deleted
google.cloud.gcp_redis_instance_info:
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloud-platform
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 0
# ----------------------------------------------------------------------------
- name: delete a instance that does not exist
- name: Delete a instance that does not exist
google.cloud.gcp_redis_instance:
name: instance37
tier: STANDARD_HA
@ -153,14 +153,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 network
- name: Delete a network
google.cloud.gcp_compute_network:
name: network-instance
project: "{{ gcp_project }}"

View file

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