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
Remember to redact any sensitive information such as authentication credentials or license keys.
Describe the bug
TASK [nginxinc.nginx : Verify that you are using a supported Jinja2 version on your Ansible host] **********************************************************************************************************************************fatal: [test.rtone.fr -> localhost]: FAILED! => {"msg": "Unexpected templating type error occurred on (Jinja2 {{ jinja2_version['stdout'] | regex_search('jinja version = ([\\\\d.]+)', '\\\\1') | first }} is supported.): 'NoneType' object is not iterable. 'NoneType' object is not iterable"}
To reproduce
Steps to reproduce the bug:
Just run a playbook including nginxinc.nginx in check mode (ansible-playbook -C my-playbook.yml)
Expected behavior
Check mode finishes without crashing and show the expected diff to be deployed on the remote target.
Your environment
Version of the Ansible NGINX role (or specific commit): 0.25.0
I would rewrite this as follow to perform the command tasks even in check mode:
- name: Extract the version of Jinja2 installed on your Ansible host
ansible.builtin.command: ansible --version
register: jinja2_version
changed_when: false
delegate_to: localhost
become: false
+ check_mode: false
- name: Extract the list of Ansible collections installed on your Ansible host
ansible.builtin.command: ansible-galaxy collection list
register: collection_list
changed_when: false
delegate_to: localhost
become: false
+ check_mode: false
The text was updated successfully, but these errors were encountered:
Al-thi
added a commit
to Al-thi/ansible-role-nginx
that referenced
this issue
Dec 19, 2024
fixnginxinc#840
Since a6712e3, ansible and jinja versions are
validated to ensure supported versions are used.
This validation is done by delegating `command` tasks to localhost, and parsing
the standard output of the executed commands, e.g. `ansible --version`.
The `ansible.builtin.command` module is not run when in check mode, causing the
variable which is supposed to get the result of the command to be empty,
resulting in an error message in the following tasks that parse these result
variables.
This commit ensures the `command` tasks are run even in check_mode. As they do
no modification on localhost, this is not dangerous.
fixnginxinc#840
Since a6712e3, ansible and jinja versions are
validated to ensure supported versions are used.
This validation is done by delegating `command` tasks to localhost, and parsing
the standard output of the executed commands, e.g. `ansible --version`.
The `ansible.builtin.command` module is not run when in check mode, causing the
variable which is supposed to get the result of the command to be empty,
resulting in an error message in the following tasks that parse these result
variables.
This commit ensures the `command` tasks are run even in check_mode. As they do
no modification on localhost, this is not dangerous.
Signed-off-by: Alexis Thietard <[email protected]>
Caution
Remember to redact any sensitive information such as authentication credentials or license keys.
Describe the bug
To reproduce
Steps to reproduce the bug:
Just run a playbook including
nginxinc.nginx
in check mode (ansible-playbook -C my-playbook.yml
)Expected behavior
Check mode finishes without crashing and show the expected diff to be deployed on the remote target.
Your environment
Additional context (optional)
I know my version is not supported, but it seems there is a bug here:
I would rewrite this as follow to perform the
command
tasks even in check mode:- name: Extract the version of Jinja2 installed on your Ansible host ansible.builtin.command: ansible --version register: jinja2_version changed_when: false delegate_to: localhost become: false + check_mode: false
- name: Extract the list of Ansible collections installed on your Ansible host ansible.builtin.command: ansible-galaxy collection list register: collection_list changed_when: false delegate_to: localhost become: false + check_mode: false
The text was updated successfully, but these errors were encountered: