Debian Codegraph @

ansible_collections/community/hashi_vault/tests/integration/targets/auth_approle/tasks/main.yml

raw
1 ---
2 # task vars are not templated when used as vars, so we'll need to set_fact this evaluate the template
3 # see: https://github.com/ansible/ansible/issues/73268
4 - name: Persist defaults
5 set_fact:
6 '{{ item.key }}': "{{ lookup('vars', item.key) }}"
7 loop: "{{ lookup('file', role_path ~ '/defaults/main.yml') | from_yaml | dict2items }}"
8 loop_control:
9 label: '{{ item.key }}'
10
11 - name: Configuration tasks
12 module_defaults:
13 vault_ci_enable_auth: '{{ vault_plugins_module_defaults_common }}'
14 vault_ci_policy_put: '{{ vault_plugins_module_defaults_common }}'
15 vault_ci_write: '{{ vault_plugins_module_defaults_common }}'
16 vault_ci_read: '{{ vault_plugins_module_defaults_common }}'
17 block:
18 - name: Canary for approle auth
19 vault_ci_read:
20 path: '{{ vault_approle_canary.path }}'
21 register: canary
22
23 - name: Configure approle
24 when: canary.result is none
25 loop: '{{ auth_paths }}'
26 include_tasks:
27 file: approle_setup.yml
28 apply:
29 vars:
30 default_path: '{{ ansible_hashi_vault_auth_method }}'
31 this_path: '{{ item }}'
32
33 - name: Write Canary
34 when: canary.result is none
35 vault_ci_write:
36 path: '{{ vault_approle_canary.path }}'
37 data:
38 value: '{{ vault_approle_canary.value }}'
39
40 - name: Run approle tests
41 loop: '{{ auth_paths | product([secret_id_role, no_secret_id_role]) | product(["target", "controller"]) | list }}'
42 include_tasks:
43 file: approle_test_{{ item[1] }}.yml
44 apply:
45 vars:
46 default_path: '{{ ansible_hashi_vault_auth_method }}'
47 this_path: '{{ item[0][0] }}'
48 approle_name: '{{ item[0][1] }}'
49 use_secret_id: '{{ item[0][1] == secret_id_role }}'
50 module_defaults:
51 assert:
52 quiet: true