Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove EOL platforms for current ones #395

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
104 changes: 104 additions & 0 deletions .config/molecule/alternative/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
- name: Run local preparation
hosts: localhost
gather_facts: false
vars:
__role_name: "{{ lookup('ansible.builtin.env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
__binary_name: "{{ __role_name }}"
__binary_url: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_url') }}"
__binary_local_dir: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_local_dir') }}"
__tls_server_config: "{{ lookup('ansible.builtin.vars', __role_name ~ '_tls_server_config', default={}) }}"
tasks:
- name: "Create local binary directory"
ansible.builtin.file:
path: "{{ __binary_local_dir }}"
state: directory
mode: 0755

- name: "Fetch binary"
become: false
ansible.builtin.unarchive:
src: "{{ __binary_url }}"
dest: "{{ __binary_local_dir }}"
remote_src: true
list_files: true
extra_opts:
- "--strip-components=1"
creates: "{{ __binary_local_dir }}/{{ __binary_name }}"
check_mode: false
register: __download_binary

- name: Generate self signed certificates
when: "'cert_file' in __tls_server_config"
block:
- name: Install pyOpenSSL for certificate generation
ansible.builtin.pip:
name: "pyOpenSSL"

- name: Create private key
community.crypto.openssl_privatekey:
path: "/tmp/tls.key"

- name: Create CSR
community.crypto.openssl_csr:
path: "/tmp/tls.csr"
privatekey_path: "/tmp/tls.key"

- name: Create certificate
community.crypto.x509_certificate:
path: "/tmp/tls.cert"
csr_path: "/tmp/tls.csr"
privatekey_path: "/tmp/tls.key"
provider: selfsigned

- name: Filter out incompatible distro/ansible version combos
ansible.builtin.add_host:
name: "{{ item }}"
groups: target_hosts
loop: >-
{{
groups['all']
| map('extract', hostvars)
| rejectattr('exclude_ansible_vers', 'defined')
| map(attribute='inventory_hostname')
| list
| union(
groups['all']
| map('extract', hostvars)
| selectattr('exclude_ansible_vers', 'defined')
| rejectattr('exclude_ansible_vers', 'search', ansible_version.major ~ '.' ~ ansible_version.minor)
| map(attribute='inventory_hostname')
| list
)
}}
when: item not in groups['target_hosts']
changed_when: false

- name: Run target preparation
hosts: target_hosts
any_errors_fatal: true
vars:
__role_name: "{{ lookup('ansible.builtin.env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
__tls_server_config: "{{ lookup('ansible.builtin.vars', __role_name ~ '_tls_server_config', default={}) }}"
tasks:
- name: Copy self signed certificates
when: "'cert_file' in __tls_server_config"
block:
- name: "Create cert dir"
ansible.builtin.file:
path: "{{ __tls_server_config.cert_file | dirname }}"
state: directory
owner: root
group: root
mode: u+rwX,g+rwX,o=rX

- name: "Copy cert and key"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode | default('0644') }}"
loop:
- src: "/tmp/tls.cert"
dest: "{{ __tls_server_config.cert_file }}"
- src: "/tmp/tls.key"
dest: "{{ __tls_server_config.key_file }}"
46 changes: 30 additions & 16 deletions .config/molecule/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,26 @@ platforms:
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: centos-7
image: dokken/centos-7
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /usr/lib/systemd/systemd
- name: centos-stream-9
image: dokken/centos-stream-9
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: debian-10
image: dokken/debian-10
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: debian-11
image: dokken/debian-11
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: fedora-37
image: dokken/fedora-37
- name: fedora-39
image: dokken/fedora-39
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: fedora-38
image: dokken/fedora-38
- name: fedora-40
image: dokken/fedora-40
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
Expand All @@ -65,8 +53,34 @@ platforms:
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
- name: ubuntu-24.04
image: dokken/ubuntu-24.04
pre_build_image: true
privileged: true
cgroup_parent: docker.slice
command: /lib/systemd/systemd
verifier:
name: testinfra
provisioner:
playbooks:
converge: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/converge.yml"
inventory:
hosts:
target_hosts:
hosts: {}
host_vars:
fedora-39:
exclude_ansible_vers:
- "2.9"
- "2.10"
- "2.11"
fedora-40:
exclude_ansible_vers:
- "2.9"
- "2.10"
- "2.11"
ubuntu-24.04:
exclude_ansible_vers:
- "2.9"
- "2.10"
- "2.11"
29 changes: 28 additions & 1 deletion .config/molecule/converge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
---
- name: Filter and add hosts to ansible_compatible_hosts
hosts: localhost
gather_facts: false
tasks:
- name: Filter out incompatible distro/ansible version combos
ansible.builtin.add_host:
name: "{{ item }}"
groups: target_hosts
loop: >-
{{
groups['all']
| map('extract', hostvars)
| rejectattr('exclude_ansible_vers', 'defined')
| map(attribute='inventory_hostname')
| list
| union(
groups['all']
| map('extract', hostvars)
| selectattr('exclude_ansible_vers', 'defined')
| rejectattr('exclude_ansible_vers', 'search', ansible_version.major ~ '.' ~ ansible_version.minor)
| map(attribute='inventory_hostname')
| list
)
}}
when: item not in groups['target_hosts']
changed_when: false

- name: Converge
hosts: all
hosts: target_hosts
any_errors_fatal: true
tasks:
- name: "Run role"
Expand Down
7 changes: 3 additions & 4 deletions roles/alertmanager/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ galaxy_info:
versions:
- "focal"
- "jammy"
- "noble"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- name: "EL"
versions:
- "7"
- "8"
- "9"
- name: "Fedora"
versions:
- "37"
- '38'
- "39"
- "40"
galaxy_tags:
- "monitoring"
- "prometheus"
Expand Down
4 changes: 4 additions & 0 deletions roles/alertmanager/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
provisioner:
playbooks:
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
inventory:
group_vars:
all:
Expand Down Expand Up @@ -34,3 +36,5 @@ provisioner:
- "127.0.0.1:6783"
- "alertmanager.demo.do.prometheus.io:6783"
alertmanager_version: 0.25.0
alertmanager_binary_url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version\
\ }}/alertmanager-{{ alertmanager_version }}.linux-amd64.tar.gz"
7 changes: 3 additions & 4 deletions roles/bind_exporter/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ galaxy_info:
versions:
- "focal"
- "jammy"
- "noble"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- name: "EL"
versions:
- "7"
- "8"
- "9"
- name: "Fedora"
versions:
- "37"
- '38'
- "39"
- "40"
galaxy_tags:
- "monitoring"
- "prometheus"
Expand Down
5 changes: 5 additions & 0 deletions roles/bind_exporter/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
provisioner:
playbooks:
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
inventory:
group_vars:
all:
Expand All @@ -19,3 +21,6 @@ provisioner:
randomuser: examplepassword
go_arch: amd64
bind_exporter_version: 0.7.0
bind_exporter_binary_url: "https://github.com/prometheus-community/bind_exporter/releases/download/v{{\
\ bind_exporter_version }}/bind_exporter-{{ bind_exporter_version\
\ }}.linux-{{ go_arch }}.tar.gz"
7 changes: 3 additions & 4 deletions roles/blackbox_exporter/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ galaxy_info:
versions:
- "focal"
- "jammy"
- "noble"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- name: "EL"
versions:
- "7"
- "8"
- "9"
- name: "Fedora"
versions:
- "37"
- '38'
- "39"
- "40"
galaxy_tags:
- "exporter"
- "monitoring"
Expand Down
7 changes: 3 additions & 4 deletions roles/cadvisor/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ galaxy_info:
versions:
- "focal"
- "jammy"
- "noble"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- name: "EL"
versions:
- "7"
- "8"
- "9"
- name: "Fedora"
versions:
- "37"
- '38'
- "39"
- "40"
galaxy_tags:
- "monitoring"
- "prometheus"
Expand Down
3 changes: 3 additions & 0 deletions roles/cadvisor/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
provisioner:
playbooks:
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
inventory:
group_vars:
all:
cadvisor_binary_url: "https://github.com/google/cadvisor/releases/download/v{{ cadvisor_version }}/cadvisor-v{{ cadvisor_version }}-linux-{{ go_arch }}"
cadvisor_binary_local_dir: "/tmp"
cadvisor_port: "8000"
go_arch: amd64
Expand Down
7 changes: 3 additions & 4 deletions roles/chrony_exporter/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ galaxy_info:
versions:
- "focal"
- "jammy"
- "noble"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- name: "EL"
versions:
- "7"
- "8"
- "9"
- name: "Fedora"
versions:
- "37"
- '38'
- "39"
- "40"
galaxy_tags:
- "monitoring"
- "prometheus"
Expand Down
5 changes: 4 additions & 1 deletion roles/chrony_exporter/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
provisioner:
playbooks:
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
inventory:
group_vars:
all:
Expand All @@ -11,7 +13,6 @@ provisioner:
- sources
chrony_exporter_disabled_collectors:
- tracking

chrony_exporter_tls_server_config:
cert_file: /etc/chrony_exporter/tls.cert
key_file: /etc/chrony_exporter/tls.key
Expand All @@ -21,3 +22,5 @@ provisioner:
randomuser: examplepassword
go_arch: amd64
chrony_exporter_version: 0.6.0
chrony_exporter_binary_url: "https://github.com/superq/chrony_exporter/releases/download/v{{ chrony_exporter_version\
\ }}/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}.tar.gz"
Loading
Loading