From 1bcd65d0a20e5e68f7708bb58d2b684150c1d7f7 Mon Sep 17 00:00:00 2001 From: Mark Bolwell Date: Tue, 11 Apr 2023 17:02:16 +0100 Subject: [PATCH] fixed ansible version check Signed-off-by: Mark Bolwell --- tasks/main.yml | 7 ++++--- vars/main.yml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index cfff2b6a..4aed6f5b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -22,9 +22,10 @@ - always - name: Check ansible version - ansible.builtin.fail: - msg: You must use ansible 2.1 or greater - when: not ansible_version.full is version_compare('2.1', '>=') + ansible.builtin.assert: + that: ansible_version.full is version_compare(min_ansible_version, '>=') + fail_msg: "You must use Ansible {{ min_ansible_version }} or greater" + success_msg: "This role is running a supported version of ansible {{ ansible_version.full }} >= {{ min_ansible_version }}" tags: - always diff --git a/vars/main.yml b/vars/main.yml index e5c244cb..1b9bcfc8 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,5 +1,7 @@ --- +min_ansible_version: 2.10.1 + # Used to control warning summary warn_control_list: "" warn_count: 0