Debian Codegraph @

ansible_collections/google/cloud/tests/integration/targets/gcp_parameter_manager/tasks/regionalparameterslookup.yml

raw symbols SCIP
1 # Copyright 2025 Google Inc.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 ---
15 # Pre-test setup
16 - name: Delete the test regional parameter if it exists
17 google.cloud.gcp_parameter_manager:
18 name: "{{ lookup_resource_name }}"
19 project: "{{ gcp_project }}"
20 location: "us-central1"
21 auth_kind: "{{ gcp_cred_kind }}"
22 service_account_file: "{{ gcp_cred_file | default(omit) }}"
23 state: absent
24 - name: Create a regional parameter
25 google.cloud.gcp_parameter_manager:
26 name: "{{ lookup_resource_name }}"
27 version: "test_version"
28 value: "ansible lookup test regional parameter value"
29 labels:
30 key1: "val1"
31 key2: "val2"
32 project: "{{ gcp_project }}"
33 location: "us-central1"
34 auth_kind: "{{ gcp_cred_kind }}"
35 service_account_file: "{{ gcp_cred_file | default(omit) }}"
36 state: present
37 - name: Add a new version to a regional parameter
38 google.cloud.gcp_parameter_manager:
39 name: "{{ lookup_resource_name }}"
40 version: "test_version_1"
41 value: "ansible lookup test regional parameter value updated"
42 project: "{{ gcp_project }}"
43 location: "us-central1"
44 auth_kind: "{{ gcp_cred_kind }}"
45 service_account_file: "{{ gcp_cred_file | default(omit) }}"
46 state: present
47 # ----------------------------------------------------------
48 - name: Retrieve the latest regional parameter version of a regional parameter
49 ansible.builtin.set_fact:
50 param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, location='us-central1', auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file ) | string }}"
51 - name: Assert regional parameter value
52 ansible.builtin.assert:
53 that:
54 - param_value is contains("ansible lookup test regional parameter value updated")
55 # ----------------------------------------------------------
56 - name: Retrieve the specified regional parameter version of a regional parameter
57 ansible.builtin.set_fact:
58 param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', location='us-central1', project=gcp_project, auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file) | string }}"
59 - name: Assert regional parameter value
60 ansible.builtin.assert:
61 that:
62 - param_value is contains("ansible lookup test regional parameter value")
63 # ---------------------------------------------------------
64 - name: Render the latest regional parameter version of a regional parameter
65 ansible.builtin.set_fact:
66 param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, location='us-central1', auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file) | string }}"
67 - name: Assert regional parameter value
68 ansible.builtin.assert:
69 that:
70 - param_value is contains("ansible lookup test regional parameter value updated")
71 # ----------------------------------------------------------
72 - name: Render the specified regional parameter version of a regional parameter
73 ansible.builtin.set_fact:
74 msg: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', location='us-central1', project=gcp_project, auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file) | string }}"
75 - name: Assert regional parameter value
76 ansible.builtin.assert:
77 that:
78 - param_value is contains("ansible lookup test regional parameter value")
79 # ---------------------------------------------------------
80 # Post-test teardown
81 # If errors happen, don't crash the playbook!
82 - name: Delete the test regional parameter version
83 google.cloud.gcp_parameter_manager:
84 name: "{{ lookup_resource_name }}"
85 version: "test_version"
86 project: "{{ gcp_project }}"
87 location: "us-central1"
88 auth_kind: "{{ gcp_cred_kind }}"
89 service_account_file: "{{ gcp_cred_file | default(omit) }}"
90 state: absent
91 ignore_errors: true
92 - name: Delete the test regional parameter version
93 google.cloud.gcp_parameter_manager:
94 name: "{{ lookup_resource_name }}"
95 version: "test_version_1"
96 project: "{{ gcp_project }}"
97 location: "us-central1"
98 auth_kind: "{{ gcp_cred_kind }}"
99 service_account_file: "{{ gcp_cred_file | default(omit) }}"
100 state: absent
101 ignore_errors: true
102 - name: Delete the test regional parameter
103 google.cloud.gcp_parameter_manager:
104 name: "{{ lookup_resource_name }}"
105 project: "{{ gcp_project }}"
106 location: "us-central1"
107 auth_kind: "{{ gcp_cred_kind }}"
108 service_account_file: "{{ gcp_cred_file | default(omit) }}"
109 state: absent
110 ignore_errors: true