Hi,
I'm trying to use jinja for setting test_plan parameter in group_vars based on some variables passed by --extra-vars.
This is my group_vars/load_drivers content:
--
{% if ENVIRONMENT_SPLIT == single %}
test_plan: '{{ load_driver_dir }}/{{ ENVIRONMENT_SPLIT }}_{{ TEST_STACK_1 }}_soak_test_plan.jmx'
{% elif "'{{ ENVIRONMENT_SPLIT }}' == 'multi'" and "'{{ TEST_STACK_2 }}' != 'None'" and "'{{ TEST_STACK_1 }}' != '{{ TEST_STACK_2 }}'" %}
test_plan: '{{ load_driver_dir }}/{{ ENVIRONMENT_SPLIT }}_{{ TEST_STACK_1 }}_{{ TEST_STACK_2 }}_soak_test_plan.jmx'
{% elif "'{{ ENVIRONMENT_SPLIT }}' == 'multi'" and "'{{ TEST_STACK_2 }}' == 'None'" %}
test_plan: '{{ load_driver_dir }}/{{ ENVIRONMENT_SPLIT }}_{{ TEST_STACK_1 }}_{{ TEST_STACK_1 }}_soak_test_plan.jmx'
{% endif %}
I execute main playbook:
ansible-playbook main.yml --extra-vars="ENVIRONMENT_SPLIT='single' TEST_STACK_1='comm1' TEST_STACK_2='comm1'"
but unfortunately I get error message:
{% if ENVIRONMENT_SPLIT == single %}
test_plan: '{{ load_driver_dir }}/{{ ENVIRONMENT_SPLIT }}_{{ TEST_STACK_1 }}_soak_test_plan.jmx'
^
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
[SSH] exit-status: 1
Finished: FAILUREI tried to use different quotas in different places but same results every time.
Can you help me with this issue?
W.