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

@ -1,3 +1,4 @@
---
# Copyright 2019 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,8 +13,8 @@
# limitations under the License.
# Pre-test setup
- name: delete a key ring
gcp_kms_key_ring:
- name: Delete a key ring
google.cloud.gcp_kms_key_ring:
name: "{{ resource_name }}"
location: us-central1
project: "{{ gcp_project }}"
@ -21,8 +22,8 @@
service_account_file: "{{ gcp_cred_file | default(omit) }}"
state: absent
#----------------------------------------------------------
- name: create a key ring
gcp_kms_key_ring:
- name: Create a key ring
google.cloud.gcp_kms_key_ring:
name: "{{ resource_name }}"
location: us-central1
project: "{{ gcp_project }}"
@ -30,26 +31,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 key_ring was created
gcp_kms_key_ring_info:
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloudkms
- name: Verify that key_ring was created
google.cloud.gcp_kms_key_ring_info:
location: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file | default(omit) }}"
scopes:
- https://www.googleapis.com/auth/cloudkms
register: results
- name: verify that command succeeded
assert:
- name: Verify that command succeeded
ansible.builtin.assert:
that:
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
# ----------------------------------------------------------------------------
- name: create a key ring that already exists
gcp_kms_key_ring:
- name: Create a key ring that already exists
google.cloud.gcp_kms_key_ring:
name: "{{ resource_name }}"
location: us-central1
project: "{{ gcp_project }}"
@ -57,7 +58,7 @@
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

View file

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