mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-09-30 05:23:29 -07:00
Merge pull request #710 from p3ck/gcp_iam_service_account-2.19
Fix jinja templating error in assert
This commit is contained in:
commit
ffc2b0765f
1 changed files with 9 additions and 4 deletions
|
@ -43,11 +43,13 @@
|
|||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: Process Results
|
||||
set_fact:
|
||||
result_resources: "{{ results['resources'] | map(attribute='name') | select('match', '.*service-' + resource_name.split('-')[-1] + '@' + gcp_project + '.iam.gserviceaccount.com.*') | list }}"
|
||||
- name: Verify that command succeeded
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*")
|
||||
| list | length == 1
|
||||
result_resources | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: Create a service account that already exists
|
||||
google.cloud.gcp_iam_service_account:
|
||||
|
@ -84,11 +86,14 @@
|
|||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: Process Results
|
||||
set_fact:
|
||||
result_resources: "{{ results['resources'] | map(attribute='name') | select('match', '.*service-' + resource_name.split('-')[-1] + '@' + gcp_project + '.iam.gserviceaccount.com.*') | list }}"
|
||||
|
||||
- name: Verify that command succeeded
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*")
|
||||
| list | length == 0
|
||||
result_resources | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: Delete a service account that does not exist
|
||||
google.cloud.gcp_iam_service_account:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue