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.
53 lines
1.6 KiB
53 lines
1.6 KiB
---
|
|
|
|
- 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.
|
|
|
|
- name: Check if jmespath is installed locally
|
|
debug: msg={{ dummy|json_query('@') }}
|
|
register: check_jmespath
|
|
ignore_errors: yes
|
|
vars:
|
|
dummy: Hello World
|
|
|
|
- name: Check if jinja 2.8 is installed locally
|
|
debug: msg={{ (dummy|selectattr("id", "equalto", "hello")|first)['value'] }}
|
|
vars:
|
|
dummy:
|
|
- id: hello
|
|
value: Hello World
|
|
register: check_jinja28
|
|
ignore_errors: yes
|
|
|
|
- name: Check if the "do" jinja extension is enabled
|
|
debug: msg={% do {}.update({}) %}{{ success }}
|
|
vars:
|
|
success: 'The do extension is enabled'
|
|
register: check_jinja_do_ext
|
|
ignore_errors: yes
|
|
|
|
- name: Ensure JMESPath is installed
|
|
assert:
|
|
that:
|
|
- 'check_jmespath is success'
|
|
msg: "The JMESPath library is required by this role. Please install the JMESPath library with 'pip install jmespath'."
|
|
|
|
- name: Ensure at least Jinja 2.8 is installed
|
|
assert:
|
|
that:
|
|
- 'check_jinja28 is success'
|
|
msg: "At least Jinja v2.8 is required by this role. Please update Jinja with 'pip install -U Jinja2'."
|
|
|
|
- name: Ensure the "do" extension of Jinja is enabled
|
|
assert:
|
|
that:
|
|
- 'check_jinja_do_ext is success'
|
|
msg: |-
|
|
You need to enable the 'do' extension of Jinja in your ansible.cfg:
|
|
[default]
|
|
jinja2_extensions = jinja2.ext.do
|
|
|