You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This syntax breaks on ansible 2.9. It works on ansible 2.10 (confirmed) and it seems it passed your tests on 2.8.
Minimal example to reproduce behavior :
--
- name: "test"
hosts: localhost
connection: local
tasks:
- name: Set empty capacity if not defined
set_fact:
capacity: "{{ capacity | default('') }}"
- name: "debug"
debug:
msg: /home/elastic/elastic-cloud-enterprise.sh {{ '--capacity ' + capacity if capacity }}
Results on Fedora 35 with Ansible 2.10.15 (python3)
ansible-playbook test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
PLAY [add admin] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [Set empty capacity if not defined] ***************************************
ok: [localhost]
TASK [debug] *****************************************************************
ok: [localhost] =>
msg: '/home/elastic/elastic-cloud-enterprise.sh '
CentOS 7.9 with ansible 2.9.27 (python 2.7.5)
ansible-playbook test.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [add admin] *************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************
ok: [localhost]
TASK [Set empty capacity if not defined] *************************************************************************************
ok: [localhost]
TASK [debug] ***************************************************************************************************************
fatal: [localhost]: FAILED! =>
msg: |-
The task includes an option with an undefined variable. The error was: the inline if-expression on line 1 evaluated to false and no else section was defined.
The error appears to be in '<my_secret_filepath>/test.yml': line 9, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
capacity: "{{ capacity | default('') }}"
- name: "debug"
^ here
I would suggest using jinja2 syntax to avoid any problems with Ansible 2.9 which I believe is the most widely used version at the moment.
I will create a PR once I check the correct jinja2 syntax.
The text was updated successfully, but these errors were encountered:
Related to #147
This syntax breaks on ansible 2.9. It works on ansible 2.10 (confirmed) and it seems it passed your tests on 2.8.
Minimal example to reproduce behavior :
Results on Fedora 35 with Ansible 2.10.15 (python3)
CentOS 7.9 with ansible 2.9.27 (python 2.7.5)
I would suggest using jinja2 syntax to avoid any problems with Ansible 2.9 which I believe is the most widely used version at the moment.
I will create a PR once I check the correct jinja2 syntax.
The text was updated successfully, but these errors were encountered: