[tutorial Ansible 2.1] a choice option
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
This commit is contained in:
parent
0fbde320ae
commit
e87d2d69b7
2 changed files with 37 additions and 3 deletions
|
@ -2,10 +2,10 @@
|
|||
- 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 !"
|
||||
when: env_apero is defined
|
||||
- name: Test variable env_apero.access.login env_apero.access.password
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
|
@ -16,4 +16,24 @@
|
|||
loop: "{{ env_apero.access }}"
|
||||
loop_control:
|
||||
loop_var: access
|
||||
when: env_apero is defined and env_apero.access is defined
|
||||
- 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 !"
|
||||
|
|
16
doc.md
16
doc.md
|
@ -31,14 +31,26 @@ This family is a leadership.
|
|||
|
||||
| Parameter | Comment |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **login**<br/>`multiple`<br/>**Type:** [`unix_user`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Login name.<br/>The account name is typically the name of foreign services. .<br/>**Example:** srep |
|
||||
| **login**<br/>`mandatory`, `multiple`<br/>**Type:** [`unix_user`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Login name.<br/>The account name is typically the name of foreign services. .<br/>**Example:** srep |
|
||||
| **password**<br/>`mandatory`<br/>**Type:** [`secret`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Password. |
|
||||
|
||||
## SREP service (env_srep)
|
||||
|
||||
| Parameter | Comment |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **apero_user**<br/>`mandatory`<br/>**Type:** [`choice`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Account to access to Apero service.<br/>**Choices:** see variable "env_apero.access.login"<br/>**Example:** srep |
|
||||
|
||||
# Example with mandatories variables
|
||||
|
||||
```
|
||||
env_proxy:
|
||||
host: proxy.silique.fr
|
||||
env_apero:
|
||||
access:
|
||||
- login: srep
|
||||
password: xxx
|
||||
env_srep:
|
||||
apero_user: srep
|
||||
```
|
||||
|
||||
# Example with all variables
|
||||
|
@ -56,4 +68,6 @@ env_apero:
|
|||
access:
|
||||
- login: srep
|
||||
password: xxx
|
||||
env_srep:
|
||||
apero_user: srep
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue