2020-04-23 04:33:44 +08:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: false
|
|
|
|
become: no
|
|
|
|
vars:
|
2021-01-11 23:49:11 +08:00
|
|
|
minimal_ansible_version: 2.9.0
|
2021-07-12 15:00:47 +08:00
|
|
|
minimal_ansible_version_2_10: 2.10.11
|
2021-05-18 20:39:31 +08:00
|
|
|
maximal_ansible_version: 2.11.0
|
2020-04-23 04:33:44 +08:00
|
|
|
ansible_connection: local
|
|
|
|
tasks:
|
2021-01-11 23:49:11 +08:00
|
|
|
- name: "Check {{ minimal_ansible_version }} <= Ansible version < {{ maximal_ansible_version }}"
|
2020-04-23 04:33:44 +08:00
|
|
|
assert:
|
2021-01-11 23:49:11 +08:00
|
|
|
msg: "Ansible must be between {{ minimal_ansible_version }} and {{ maximal_ansible_version }}"
|
2020-04-23 04:33:44 +08:00
|
|
|
that:
|
|
|
|
- ansible_version.string is version(minimal_ansible_version, ">=")
|
2021-01-11 23:49:11 +08:00
|
|
|
- ansible_version.string is version(maximal_ansible_version, "<")
|
2020-04-23 04:33:44 +08:00
|
|
|
tags:
|
|
|
|
- check
|
2021-04-13 15:43:01 +08:00
|
|
|
|
2021-07-12 15:00:47 +08:00
|
|
|
- name: "Check Ansible version > {{ minimal_ansible_version_2_10 }} when using ansible 2.10"
|
|
|
|
assert:
|
|
|
|
msg: "When using Ansible 2.10, the minimum supported version is {{ minimal_ansible_version_2_10 }}"
|
|
|
|
that:
|
|
|
|
- ansible_version.string is version(minimal_ansible_version_2_10, ">=")
|
|
|
|
- ansible_version.string is version(maximal_ansible_version, "<")
|
|
|
|
when:
|
|
|
|
- ansible_version.string is version('2.10.0', ">=")
|
|
|
|
tags:
|
|
|
|
- check
|
|
|
|
|
2021-04-13 15:43:01 +08:00
|
|
|
- name: "Check that python netaddr is installed"
|
|
|
|
assert:
|
|
|
|
msg: "Python netaddr is not present"
|
|
|
|
that: "'127.0.0.1' | ipaddr"
|
|
|
|
tags:
|
|
|
|
- check
|
|
|
|
|
|
|
|
# CentOS 7 provides too old jinja version
|
|
|
|
- name: "Check that jinja is not too old (install via pip)"
|
|
|
|
assert:
|
|
|
|
msg: "Your Jinja version is too old, install via pip"
|
|
|
|
that: "{% set test %}It works{% endset %}{{ test == 'It works' }}"
|
|
|
|
tags:
|
|
|
|
- check
|