This is a plugin that verifies if the Ansible version meets the version requirements.
You can use the same range identifiers from Ansible Galaxy, separate by commas:
*: The most recent version. This is the default.
!=: Not equal to the version specified.
==: Exactly the version specified.
>=: Greater than or equal to the version specified.
>: Greater than the version specified.
<=: Less than or equal to the version specified.
<: Less than the version specified.
The plugin has been tested only with ansible-core 2.12 and certainly will not work with ansible 2.9.
Download the ansible_version.py
file into your callbacks_plugins
folder.
You can either configure the version_requirements
parameter in ansible.cfg
defaults section or set the ANSIBLE_VERSION_REQUIREMENTS
environment variable.
[defaults]
version_requirements = ">=2.12,<2.13"
callbacks_enabled = ansible_version
bin_ansible_callbacks = True # optional
or
$ ANSIBLE_VERSION_REQUIREMENTS=">=2.12,<2.13" ansible-playbook playbook.yml
The bin_ansible_callbacks
is only necessary if you want it to work with adhoc ansible commands (besides ansible-playbook).