-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check mode is broken by ansible version validation #840
Comments
Al-thi
added a commit
to Al-thi/ansible-role-nginx
that referenced
this issue
Dec 19, 2024
fix nginxinc#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.
5 tasks
Al-thi
added a commit
to Al-thi/ansible-role-nginx
that referenced
this issue
Dec 19, 2024
fix nginxinc#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]>
Al-thi
added a commit
to Al-thi/ansible-role-nginx
that referenced
this issue
Jan 8, 2025
fix nginxinc#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]>
Al-thi
added a commit
to Al-thi/ansible-role-nginx
that referenced
this issue
Jan 10, 2025
fix nginxinc#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]>
github-project-automation
bot
moved this from To do
to Done
in NGINX Ansible roles & collection
Jan 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: