[tutorial Ansible 4.1] conditional disabled variable
NFS configuration ================= Need could be activated. In this case, we need to add server domain name --- env_nfs: configure: true server: another-nfs.silique.fr Examples of Ops inventory file ============================== 1/ INVALID, only with Rougail: --- env_nfs: configure: false server: another-nfs.silique.fr 2/ VALID: --- env_nfs: configure: true
This commit is contained in:
parent
6505eb6255
commit
8efd2ea342
4 changed files with 7 additions and 0 deletions
|
@ -16,3 +16,6 @@
|
|||
- name: Display variable env_nfs_all.configure
|
||||
ansible.builtin.debug:
|
||||
var: env_nfs_all.configure
|
||||
- name: Display variable env_nfs_all.server
|
||||
ansible.builtin.debug:
|
||||
var: env_nfs_all.server
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
- env_nfs_all is defined
|
||||
- env_nfs_all.configure is defined
|
||||
- env_nfs_all.configure is boolean
|
||||
- not env_nfs_all.configure or env_nfs.server is defined
|
||||
- not env_nfs_all.configure or env_nfs.server is string
|
||||
fail_msg:
|
||||
- Please configure your NFS manually
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
env_nfs_all:
|
||||
configure: "{{ env_nfs.configure | default(false) }}"
|
||||
server: "{{ env_nfs.server | default('nfs.silique.fr') }}"
|
||||
|
|
1
doc.md
1
doc.md
|
@ -51,6 +51,7 @@ This family is a leadership.
|
|||
| Parameter | Comment |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **configure**<br/>`mandatory`<br/>**Type:** [`boolean`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | Configure NFS mount.<br/>To share documents between differents services, you need to configure a NFS server .<br/>**Default:** False |
|
||||
| **server**<br/>`mandatory`<br/>**Type:** [`domainname`](https://forge.cloud.silique.fr/stove/rougail/src/branch/main/doc/variable/README.md#le-type-de-la-variable) | NFS server name.<br/>Configure NFS server only if env_nfs.configure is true.<br/>**Default:** nfs.silique.fr |
|
||||
|
||||
# Example with mandatories variables
|
||||
|
||||
|
|
Loading…
Reference in a new issue