Skip to content

Commit

Permalink
fix: ansible versions validation tasks
Browse files Browse the repository at this point in the history
fix #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.
  • Loading branch information
Al-thi committed Dec 19, 2024
1 parent eb60ddf commit 3c50a6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tasks/validate/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
changed_when: false
delegate_to: localhost
become: false
check_mode: false

- name: Verify that you are using a supported Jinja2 version on your Ansible host
ansible.builtin.assert:
Expand All @@ -30,6 +31,7 @@
changed_when: false
delegate_to: localhost
become: false
check_mode: false

- name: Verify that the 'community.general' Ansible collection is installed on your Ansible host
ansible.builtin.assert:
Expand Down

0 comments on commit 3c50a6e

Please # to comment.