Re: [ansible-project] How to make mandatory variables if variable is defined

2018-04-05 Thread Kai Stian Olstad

On 05.04.2018 08:57, Javier Martí wrote:
Hi, I want to make sure before execution of the role that if a variable 
is

defined you have to define another variables, can I do that?

I have a template:

{% if variable1 != '' %}
variable1 = {{ variable1 }}
variable2 = {{ variable2 }}
variable3 = {{ variable3 }}
{% endif %}

How to make mandatory variable2 and variable3 if variable1 is defined?



  - assert:
  that:
- variable2 is defined
- variable3 is defined
when: variable1 is defined


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fb8cdcfeb4dab5c5082d2a4ae4df1831%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to make mandatory variables if variable is defined

2018-04-04 Thread Javier Martí
Hi, I want to make sure before execution of the role that if a variable is 
defined you have to define another variables, can I do that?

I have a template:

{% if variable1 != '' %}
variable1 = {{ variable1 }}
variable2 = {{ variable2 }}
variable3 = {{ variable3 }}
{% endif %}

How to make mandatory variable2 and variable3 if variable1 is defined?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5de44439-f65c-4d0d-be40-0640dc0152b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.