Hi,
I'm playing around with Ansible for few hours - it is very interesting
(and feature list is exactly what I was looking for), but it seams to
be a bit inflexible to me. Maybe, I just don't understand the concepts
correctly. Therefore, here and in following posts I will ask some
questions ...
Do I understand it correctly that (Python) expressions are only
evaluated as the "only_if" value? I would prefer to have evaluation in
the "vars" section of a playbook to make it more modular. Similar toi
this example:
- hosts: foo
vars:
is_correct_platform: "'{{ansible_product_name}}' == 'VMware
Virtual Platform'"
tmp_dir: "/tmp/foo"
tmp_file: "{{tmp_dir}}/myfile"
file_exists: "os.path.isfile('{{tmp_file}}')"
do_action: "{{is_correct_platform}} and not({{file_exists}})"
tasks
- name: foo1
action: ...
only_if: "{{do_action}}"
- name: foo2
action: ...
only_if: "{{do_action}}"
Can I do this in a different way? Are changes scheduled for future
releases?
Thanks,
Frank