On Monday, October 26, 2015 at 7:01:09 PM UTC+1, Brian Coca wrote:
>
> you can define vars that depend on the condition: 
>
>
Hi Brian,

my problem is that I want to do this in the tasks/main.yml of a certain 
role. It seems it is not possible to define vars on the same level as the 
tasks:

 - vars:
    - file:         /tmp/zb
    - link:       blip.stat.exists and blip.stat.islink
- name: bepaal stat van file {{file}}
  stat: path={{file}}
  register: blip

- name: is exists true?
  when: blip.stat.exists
  debug: msg="blip.stat.isdir exists"

Obviously this syntax is not OK (ERROR: vars is not a legal parameter in an 
Ansible task or handler). Because I want to do this to enhance readability, 
the only solution I see for now, moving it to the playbook itself, is not 
much of a good idea.
Is it possible to have var definition in the role file itself in some way?

regards, Ruud

-- 
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/8ca09144-8790-4eea-abd4-854db52e36cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to