Check supported host OS distributions in prechecks
This should help to ensure that users are running tested and supported host OS distributions. Change-Id: I6ee76463d284ad4f3646af1c7ec2b7e50e2f3b15 Partially-Implements: blueprint improve-prechecks
This commit is contained in:
parent
021de4c0ba
commit
d20c65ed48
3
ansible/roles/prechecks/defaults/main.yml
Normal file
3
ansible/roles/prechecks/defaults/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
# Whether to enable checks for host OS distribution and release.
|
||||
prechecks_enable_host_os_checks: true
|
18
ansible/roles/prechecks/tasks/host_os_checks.yml
Normal file
18
ansible/roles/prechecks/tasks/host_os_checks.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Checking host OS distribution
|
||||
fail:
|
||||
msg: >-
|
||||
Host OS distribution {{ ansible_distribution }} is not supported.
|
||||
Supported distributions are: {{ host_os_distributions.keys() | join(', ') }}
|
||||
when: ansible_distribution not in host_os_distributions
|
||||
|
||||
- name: Checking host OS release or version
|
||||
fail:
|
||||
msg: >-
|
||||
{{ ansible_distribution }} release {{ ansible_distribution_release }} is
|
||||
not supported. Supported releases are:
|
||||
{{ host_os_distributions[ansible_distribution] | join(', ') }}
|
||||
when:
|
||||
- ansible_distribution_release not in host_os_distributions[ansible_distribution]
|
||||
- ansible_distribution_version not in host_os_distributions[ansible_distribution]
|
||||
- ansible_distribution_major_version not in host_os_distributions[ansible_distribution]
|
@ -1,4 +1,7 @@
|
||||
---
|
||||
- include_tasks: host_os_checks.yml
|
||||
when: prechecks_enable_host_os_checks | bool
|
||||
|
||||
- include_tasks: port_checks.yml
|
||||
when:
|
||||
- inventory_hostname not in groups['deployment']|default([])
|
||||
|
@ -3,3 +3,17 @@ docker_version_min: '1.10.0'
|
||||
docker_py_version_min: '2.0.0'
|
||||
ansible_version_min: '2.8'
|
||||
ansible_version_max: '2.9'
|
||||
|
||||
# Top level keys should match ansible_distribution.
|
||||
# These map to lists of supported releases (ansible_distribution_release) or
|
||||
# versions (ansible_distribution_version or ansible_distribution_major_version)
|
||||
# for that distribution.
|
||||
host_os_distributions:
|
||||
CentOS:
|
||||
- "8"
|
||||
Debian:
|
||||
- "buster"
|
||||
RHEL:
|
||||
- "8"
|
||||
Ubuntu:
|
||||
- "bionic"
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Adds a new precheck for supported host OS distributions. Currently
|
||||
supported distributions are CentOS/RHEL 8, Debian Buster and Ubuntu Bionic.
|
||||
This check can be disabled by setting ``prechecks_enable_host_os_checks``
|
||||
to ``false``.
|
Loading…
Reference in New Issue
Block a user