Fix jinja templating error in assert

Fixes templating for ansible-2.19.
This commit is contained in:
Bill Peck 2025-09-10 16:16:14 -04:00
commit ec0a9a3a7c
No known key found for this signature in database
GPG key ID: 4F58AAF36968538F
2 changed files with 24 additions and 32 deletions

View file

@ -43,40 +43,36 @@
state: present
# ----------------------------------------------------------
- name: Retrieve the latest parameter version of a parameter
ansible.builtin.debug:
msg: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file | default(omit)) }}"
register: result
ansible.builtin.set_fact:
param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file) | string }}"
- name: Assert parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test parameter value updated"
- param_value is contains("ansible lookup test parameter value updated")
# ----------------------------------------------------------
- name: Retrieve the specified parameter version of a parameter
ansible.builtin.debug:
msg: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', project=gcp_project, auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file | default(omit)) }}"
register: result
ansible.builtin.set_fact:
param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', project=gcp_project, auth_kind=gcp_cred_kind, service_account_file=gcp_cred_file) | string }}"
- name: Assert parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test parameter value"
- param_value is contains("ansible lookup test parameter value")
# ---------------------------------------------------------
- name: Render the latest parameter version of a parameter
ansible.builtin.debug:
msg: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file | default(omit)) }}"
register: result
ansible.builtin.set_fact:
param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, project=gcp_project, auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file) | string }}"
- name: Assert parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test parameter value updated"
- param_value is contains("ansible lookup test parameter value updated")
# ----------------------------------------------------------
- name: Render the specified parameter version of a parameter
ansible.builtin.debug:
msg: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', project=gcp_project, auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file | default(omit)) }}"
register: result
ansible.builtin.set_fact:
param_value: "{{ lookup('google.cloud.gcp_parameter_manager', key=lookup_resource_name, version='test_version', project=gcp_project, auth_kind=gcp_cred_kind, render_secret=True, service_account_file=gcp_cred_file) | string }}"
- name: Assert parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test parameter value"
- param_value is contains ("ansible lookup test parameter value")
# ---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!

View file

@ -46,40 +46,36 @@
state: present
# ----------------------------------------------------------
- name: Retrieve the latest regional parameter version of a regional parameter
ansible.builtin.debug:
msg: "{{ 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 | default(omit)) }}"
register: result
ansible.builtin.set_fact:
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 }}"
- name: Assert regional parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test regional parameter value updated"
- param_value is contains("ansible lookup test regional parameter value updated")
# ----------------------------------------------------------
- name: Retrieve the specified regional parameter version of a regional parameter
ansible.builtin.debug:
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, service_account_file=gcp_cred_file | default(omit)) }}"
register: result
ansible.builtin.set_fact:
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 }}"
- name: Assert regional parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test regional parameter value"
- param_value is contains("ansible lookup test regional parameter value")
# ---------------------------------------------------------
- name: Render the latest regional parameter version of a regional parameter
ansible.builtin.debug:
msg: "{{ 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 | default(omit)) }}"
register: result
ansible.builtin.set_fact:
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 }}"
- name: Assert regional parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test regional parameter value updated"
- param_value is contains("ansible lookup test regional parameter value updated")
# ----------------------------------------------------------
- name: Render the specified regional parameter version of a regional parameter
ansible.builtin.debug:
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 | default(omit)) }}"
register: result
ansible.builtin.set_fact:
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 }}"
- name: Assert regional parameter value
ansible.builtin.assert:
that:
- result.msg == "ansible lookup test regional parameter value"
- param_value is contains("ansible lookup test regional parameter value")
# ---------------------------------------------------------
# Post-test teardown
# If errors happen, don't crash the playbook!