Hi Everyone.
Currently I’m working in a script that should be capable of install software in different distros.
But my problem is that I want to simplify my role conditions putting them in a file.
For example:
My common vars file would be like this:
ubuntu Versions
is_1004: “‘$ansible_distribution_version’ == ‘10.04’”
is_1010: “‘$ansible_distribution_version’ == ‘10.10’”
is_1104: “‘$ansible_distribution_version’ == ‘11.04’”
is_1110: “‘$ansible_distribution_version’ == ‘11.10’”
is_1204: “‘$ansible_distribution_version’ == ‘12.04’”
is_1210: “‘$ansible_distribution_version’ == ‘12.10’”
is_1304: “‘$ansible_distribution_version’ == ‘13.04’”
is_two_selected: “$is_1004 or $is_1010”
And my roles selection file:
roles:
- { role: Ubuntu_List, when: $is_two_selected}
But it keeps giving me this error:
TASK: [Adding source.] ********************************************************
fatal: [192.168.1.112] => Conditional expression must evaluate to True or False: {% if ‘6.2’ == ‘10.04’ or ‘6.2’ == ‘10.10’ %} True {% else %} False {% endif %}
FATAL: all hosts have already failed – aborting
Does ansible support variable sutitution? Or I’m doing something wrong?
If I put the plain string in the when condition ($ansible_distribution_version’ == ‘10.04’ or $ansible_distribution_version’ == ‘10.10’) the script executes normally.
Thanks in advance.