Compare commits
3 commits
284b8792f3
...
68b7a4a342
| Author | SHA1 | Date | |
|---|---|---|---|
| 68b7a4a342 | |||
|
db70d666d1 |
|||
|
7b8dab07b6 |
8 changed files with 2 additions and 134 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -2,5 +2,7 @@
|
||||||
"search.exclude": {
|
"search.exclude": {
|
||||||
"/playbooks/roles/": true,
|
"/playbooks/roles/": true,
|
||||||
"/playbooks/resources/": true,
|
"/playbooks/resources/": true,
|
||||||
|
"/ansible_collections/": true,
|
||||||
|
"/galaxy-roles/": true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- role: distribution_check
|
|
||||||
vars:
|
|
||||||
distribution_check__distribution_support_spec:
|
|
||||||
- name: Debian
|
|
||||||
major_versions:
|
|
||||||
- 11
|
|
||||||
- 12
|
|
||||||
- 13
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
# Role `distribution_check`
|
|
||||||
|
|
||||||
This role checks if the distribution of the hosts is supported (part of the provided distribution support spec.) and fails if it's not.
|
|
||||||
|
|
||||||
If a hosts distribution and either an accompanying distribution version, major version or release is supported, the role doesn't fail for the host in question.
|
|
||||||
|
|
||||||
## Required Arguments
|
|
||||||
|
|
||||||
For the required arguments look at the [`argument_specs.yaml`](./meta/argument_specs.yaml).
|
|
||||||
|
|
||||||
## `hosts`
|
|
||||||
|
|
||||||
The `hosts` for this role need to be the machines for which you want to make sure their distribution is supported.
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
argument_specs:
|
|
||||||
main:
|
|
||||||
options:
|
|
||||||
distribution_check__distribution_support_spec:
|
|
||||||
description: A spec specifying the supported distribution.
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
required: true
|
|
||||||
options:
|
|
||||||
name:
|
|
||||||
description: The name of the supported distribution.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
versions:
|
|
||||||
description: The supported versions of the supported distribution.
|
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
required: false
|
|
||||||
major_versions:
|
|
||||||
description: The supported major versions of the supported distribution.
|
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
required: false
|
|
||||||
releases:
|
|
||||||
description: The supported releases of the supported distribution.
|
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
required: false
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
- name: set fact holding list of supported distribution names
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__supported_distribution_names: "{{ distribution_check__distribution_support_spec
|
|
||||||
| community.general.json_query('[].name') }}"
|
|
||||||
|
|
||||||
- name: fail on unsupported distribution (name)
|
|
||||||
ansible.builtin.fail:
|
|
||||||
msg: The hosts distribution (name) isn't supported.
|
|
||||||
when: ansible_facts['distribution'] not in distribution_check__supported_distribution_names
|
|
||||||
|
|
||||||
- name: set facts for holding lists of supported distribution versions, major versions and releases
|
|
||||||
block:
|
|
||||||
- name: set fact holding list of supported distribution versions
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__supported_distribution_versions: "{{ distribution_check__distribution_support_spec
|
|
||||||
| community.general.json_query(distribution_check__supported_distribution_versions_query) }}"
|
|
||||||
vars:
|
|
||||||
distribution_check__supported_distribution_versions_query: "[?name=='{{ ansible_facts['distribution'] }}'].versions | [].to_string(@)"
|
|
||||||
|
|
||||||
- name: set fact holding list of supported distribution major versions
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__supported_distribution_major_versions: "{{ distribution_check__distribution_support_spec
|
|
||||||
| community.general.json_query(distribution_check__supported_distribution_major_versions_query) }}"
|
|
||||||
vars:
|
|
||||||
distribution_check__supported_distribution_major_versions_query: "[?name=='{{ ansible_facts['distribution'] }}'].major_versions | [].to_string(@)"
|
|
||||||
|
|
||||||
- name: set fact holding list of supported distribution releases
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__supported_distribution_releases: "{{ distribution_check__distribution_support_spec
|
|
||||||
| community.general.json_query(distribution_check__supported_distribution_releases_query) }}"
|
|
||||||
vars:
|
|
||||||
distribution_check__supported_distribution_releases_query: "[?name=='{{ ansible_facts['distribution'] }}'].releases | [].to_string(@)"
|
|
||||||
|
|
||||||
- name: check for distribution version, major version and release support
|
|
||||||
block:
|
|
||||||
- name: set fact on whether the distribution version is supported
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__distribution_version_supported: "{{ ansible_facts['distribution_version'] in distribution_check__supported_distribution_versions }}"
|
|
||||||
|
|
||||||
- name: set fact on whether the distribution major version is supported
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__distribution_major_version_supported: "{{ ansible_facts['distribution_major_version'] in distribution_check__supported_distribution_major_versions }}" # noqa: yaml[line-length]
|
|
||||||
|
|
||||||
- name: set fact on whether the distribution release is supported
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
distribution_check__distribution_release_supported: "{{ ansible_facts['distribution_release'] in distribution_check__supported_distribution_releases }}"
|
|
||||||
|
|
||||||
- name: fail, if neither the distributions version, major version or release is supported
|
|
||||||
ansible.builtin.fail:
|
|
||||||
msg: Neither the hosts distribution version, major version or release is supported.
|
|
||||||
when: not (distribution_check__distribution_version_supported
|
|
||||||
or distribution_check__distribution_major_version_supported
|
|
||||||
or distribution_check__distribution_release_supported)
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- role: distribution_check
|
|
||||||
vars:
|
|
||||||
distribution_check__distribution_support_spec:
|
|
||||||
- name: Debian
|
|
||||||
major_versions:
|
|
||||||
- 11
|
|
||||||
- 12
|
|
||||||
- 13
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- role: distribution_check
|
|
||||||
vars:
|
|
||||||
distribution_check__distribution_support_spec:
|
|
||||||
- name: Debian
|
|
||||||
major_versions:
|
|
||||||
- 11
|
|
||||||
- 12
|
|
||||||
- 13
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
dependencies:
|
|
||||||
- role: distribution_check
|
|
||||||
vars:
|
|
||||||
distribution_check__distribution_support_spec:
|
|
||||||
- name: Debian
|
|
||||||
major_versions:
|
|
||||||
- "11"
|
|
||||||
- "12"
|
|
||||||
- "13"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue