Emmanuel Garette
e87d2d69b7
Apero configuration =================== Login is now mandatory Use an existant user login --- env_apero: access: - login: srep password: oIJuheu27__u2 - login: snom password: oIJuheu27__u2 env_srep: apero_user: srep Examples of Ops inventory file ============================== 1/ INVALID, use an unexisted user: --- env_apero: access: - login: srep password: oIJuheu27__u2 - login: snom password: oIJuheu27__u2 env_srep: apero_user: unknown
39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
---
|
|
- name: Test variable env_apero.access
|
|
ansible.builtin.assert:
|
|
that:
|
|
- env_apero is defined
|
|
- env_apero.access is defined
|
|
- env_apero.access | type_debug == 'list'
|
|
fail_msg: "env_apero.access n'existe pas ou est de mauvais type !"
|
|
- name: Test variable env_apero.access.login env_apero.access.password
|
|
ansible.builtin.assert:
|
|
that:
|
|
- access is mapping
|
|
- access.login is defined
|
|
- access.password is defined
|
|
fail_msg: "La variable n'existe pas ou est de mauvais type !"
|
|
loop: "{{ env_apero.access }}"
|
|
loop_control:
|
|
loop_var: access
|
|
- name: Test variable env_srep.apero_user
|
|
ansible.builtin.assert:
|
|
that:
|
|
- env_srep is defined
|
|
- env_srep.apero_user is defined
|
|
fail_msg: "La variable n'existe pas ou est de mauvais type !"
|
|
- name: Test variable env_srep.apero_user
|
|
ansible.builtin.set_fact:
|
|
found: false
|
|
- name: Test variable env_srep.apero_user
|
|
ansible.builtin.set_fact:
|
|
found: true
|
|
when: access.login == env_srep.apero_user
|
|
loop: "{{ env_apero.access }}"
|
|
loop_control:
|
|
loop_var: access
|
|
- name: Test variable env_srep.apero_user
|
|
ansible.builtin.assert:
|
|
that:
|
|
- found is true
|
|
fail_msg: "La variable n'existe pas ou est de mauvais type !"
|