My personal website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

812 B

title date opensource topics
Check the Ansible version number in a playbook 2019-11-18T00:00:00+02:00 [Ansible] [IT Automation]

My Ansible playbooks sometimes use features that are available only in a very recent versions of Ansible.

To prevent unecessary troubles to the team mates that will execute them, I like to add a task at the very beginning of my playbooks to check the Ansible version number and abort if the requirements are not met.

- name: Verify that Ansible version is >= 2.4.6
  assert:
    that: "ansible_version.full is version_compare('2.4.6', '>=')"
    msg: >-
      This module requires at least Ansible 2.4.6. The version that comes
      with RHEL and CentOS by default (2.4.2) has a known bug that prevent
      this role from running properly.