From 94fb802ec2c5efcf50ffcd210e3cea5abddc7ba0 Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 1 Jul 2024 13:07:50 +0000 Subject: [PATCH 01/13] removed: drop debian 10 support as it is EOL Signed-off-by: gardar --- .config/molecule/config.yml | 6 ------ roles/alertmanager/meta/main.yml | 1 - roles/bind_exporter/meta/main.yml | 1 - roles/blackbox_exporter/meta/main.yml | 1 - roles/cadvisor/meta/main.yml | 1 - roles/chrony_exporter/meta/main.yml | 1 - roles/fail2ban_exporter/meta/main.yml | 1 - roles/ipmi_exporter/meta/main.yml | 1 - roles/memcached_exporter/meta/main.yml | 1 - roles/mongodb_exporter/meta/main.yml | 1 - roles/mysqld_exporter/meta/main.yml | 1 - roles/nginx_exporter/meta/main.yml | 1 - roles/node_exporter/meta/main.yml | 1 - roles/postgres_exporter/meta/main.yml | 1 - roles/process_exporter/meta/main.yml | 1 - roles/prometheus/meta/main.yml | 1 - roles/pushgateway/meta/main.yml | 1 - roles/redis_exporter/meta/main.yml | 1 - roles/smartctl_exporter/meta/main.yml | 1 - roles/smokeping_prober/meta/main.yml | 1 - roles/snmp_exporter/meta/main.yml | 1 - roles/systemd_exporter/meta/main.yml | 1 - 22 files changed, 27 deletions(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 9e44a5c99..938cfee4f 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -29,12 +29,6 @@ platforms: 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 diff --git a/roles/alertmanager/meta/main.yml b/roles/alertmanager/meta/main.yml index a7af71c72..b444c2e6b 100644 --- a/roles/alertmanager/meta/main.yml +++ b/roles/alertmanager/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/bind_exporter/meta/main.yml b/roles/bind_exporter/meta/main.yml index 6fb907d79..f0ad31fcc 100644 --- a/roles/bind_exporter/meta/main.yml +++ b/roles/bind_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/blackbox_exporter/meta/main.yml b/roles/blackbox_exporter/meta/main.yml index 22d09ac6a..632dece76 100644 --- a/roles/blackbox_exporter/meta/main.yml +++ b/roles/blackbox_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/cadvisor/meta/main.yml b/roles/cadvisor/meta/main.yml index ecf9c0d18..8a40e6030 100644 --- a/roles/cadvisor/meta/main.yml +++ b/roles/cadvisor/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/chrony_exporter/meta/main.yml b/roles/chrony_exporter/meta/main.yml index 09c61e432..5273638a6 100644 --- a/roles/chrony_exporter/meta/main.yml +++ b/roles/chrony_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/fail2ban_exporter/meta/main.yml b/roles/fail2ban_exporter/meta/main.yml index a96dd7406..f4e463924 100644 --- a/roles/fail2ban_exporter/meta/main.yml +++ b/roles/fail2ban_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/ipmi_exporter/meta/main.yml b/roles/ipmi_exporter/meta/main.yml index b0f6e6f70..2585240d4 100644 --- a/roles/ipmi_exporter/meta/main.yml +++ b/roles/ipmi_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/memcached_exporter/meta/main.yml b/roles/memcached_exporter/meta/main.yml index ee76e7238..19042e3a3 100644 --- a/roles/memcached_exporter/meta/main.yml +++ b/roles/memcached_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/mongodb_exporter/meta/main.yml b/roles/mongodb_exporter/meta/main.yml index 25b2fe0f6..4deb45508 100644 --- a/roles/mongodb_exporter/meta/main.yml +++ b/roles/mongodb_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/mysqld_exporter/meta/main.yml b/roles/mysqld_exporter/meta/main.yml index 286ae0966..1599aa329 100644 --- a/roles/mysqld_exporter/meta/main.yml +++ b/roles/mysqld_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/nginx_exporter/meta/main.yml b/roles/nginx_exporter/meta/main.yml index f1a9ece20..6871cc7a9 100644 --- a/roles/nginx_exporter/meta/main.yml +++ b/roles/nginx_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/node_exporter/meta/main.yml b/roles/node_exporter/meta/main.yml index 085d1e937..56cc5cccb 100644 --- a/roles/node_exporter/meta/main.yml +++ b/roles/node_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/postgres_exporter/meta/main.yml b/roles/postgres_exporter/meta/main.yml index 5fa587908..5652ac239 100644 --- a/roles/postgres_exporter/meta/main.yml +++ b/roles/postgres_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/process_exporter/meta/main.yml b/roles/process_exporter/meta/main.yml index 5c89712fa..3c4cc00d5 100644 --- a/roles/process_exporter/meta/main.yml +++ b/roles/process_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/prometheus/meta/main.yml b/roles/prometheus/meta/main.yml index 3223047bb..a71fd5f71 100644 --- a/roles/prometheus/meta/main.yml +++ b/roles/prometheus/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/pushgateway/meta/main.yml b/roles/pushgateway/meta/main.yml index 265270c4a..ad9360e8c 100644 --- a/roles/pushgateway/meta/main.yml +++ b/roles/pushgateway/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/redis_exporter/meta/main.yml b/roles/redis_exporter/meta/main.yml index 39c7309db..44541fd09 100644 --- a/roles/redis_exporter/meta/main.yml +++ b/roles/redis_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/smartctl_exporter/meta/main.yml b/roles/smartctl_exporter/meta/main.yml index 7b07de82b..c69456584 100644 --- a/roles/smartctl_exporter/meta/main.yml +++ b/roles/smartctl_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/smokeping_prober/meta/main.yml b/roles/smokeping_prober/meta/main.yml index 8ca716caa..8d8a895d8 100644 --- a/roles/smokeping_prober/meta/main.yml +++ b/roles/smokeping_prober/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/snmp_exporter/meta/main.yml b/roles/snmp_exporter/meta/main.yml index f2abacebf..ce60ad1b2 100644 --- a/roles/snmp_exporter/meta/main.yml +++ b/roles/snmp_exporter/meta/main.yml @@ -12,7 +12,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" diff --git a/roles/systemd_exporter/meta/main.yml b/roles/systemd_exporter/meta/main.yml index 0bde46229..2bd56f943 100644 --- a/roles/systemd_exporter/meta/main.yml +++ b/roles/systemd_exporter/meta/main.yml @@ -13,7 +13,6 @@ galaxy_info: - name: "Debian" versions: - "bullseye" - - "buster" - name: "EL" versions: - "7" From f668cd0ac44dbf6d111e1b4e7ac522d032396f1c Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 1 Jul 2024 13:09:16 +0000 Subject: [PATCH 02/13] removed: drop centos 7 support as it is EOL Signed-off-by: gardar --- .config/molecule/config.yml | 6 ------ roles/alertmanager/meta/main.yml | 1 - roles/bind_exporter/meta/main.yml | 1 - roles/blackbox_exporter/meta/main.yml | 1 - roles/cadvisor/meta/main.yml | 1 - roles/chrony_exporter/meta/main.yml | 1 - roles/fail2ban_exporter/meta/main.yml | 1 - roles/ipmi_exporter/meta/main.yml | 1 - roles/memcached_exporter/meta/main.yml | 1 - roles/mongodb_exporter/meta/main.yml | 1 - roles/mysqld_exporter/meta/main.yml | 1 - roles/nginx_exporter/meta/main.yml | 1 - roles/node_exporter/meta/main.yml | 1 - roles/postgres_exporter/meta/main.yml | 1 - roles/process_exporter/meta/main.yml | 1 - roles/prometheus/meta/main.yml | 1 - roles/pushgateway/meta/main.yml | 1 - roles/redis_exporter/meta/main.yml | 1 - roles/smartctl_exporter/meta/main.yml | 1 - roles/smokeping_prober/meta/main.yml | 1 - roles/snmp_exporter/meta/main.yml | 1 - roles/systemd_exporter/meta/main.yml | 1 - 22 files changed, 27 deletions(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 938cfee4f..cd0195c32 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -17,12 +17,6 @@ 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 diff --git a/roles/alertmanager/meta/main.yml b/roles/alertmanager/meta/main.yml index b444c2e6b..4367ca0d4 100644 --- a/roles/alertmanager/meta/main.yml +++ b/roles/alertmanager/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/bind_exporter/meta/main.yml b/roles/bind_exporter/meta/main.yml index f0ad31fcc..9be3fdd28 100644 --- a/roles/bind_exporter/meta/main.yml +++ b/roles/bind_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/blackbox_exporter/meta/main.yml b/roles/blackbox_exporter/meta/main.yml index 632dece76..85d155199 100644 --- a/roles/blackbox_exporter/meta/main.yml +++ b/roles/blackbox_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/cadvisor/meta/main.yml b/roles/cadvisor/meta/main.yml index 8a40e6030..1ad1bfcd8 100644 --- a/roles/cadvisor/meta/main.yml +++ b/roles/cadvisor/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/chrony_exporter/meta/main.yml b/roles/chrony_exporter/meta/main.yml index 5273638a6..80e274760 100644 --- a/roles/chrony_exporter/meta/main.yml +++ b/roles/chrony_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/fail2ban_exporter/meta/main.yml b/roles/fail2ban_exporter/meta/main.yml index f4e463924..6ae349af1 100644 --- a/roles/fail2ban_exporter/meta/main.yml +++ b/roles/fail2ban_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/ipmi_exporter/meta/main.yml b/roles/ipmi_exporter/meta/main.yml index 2585240d4..969700673 100644 --- a/roles/ipmi_exporter/meta/main.yml +++ b/roles/ipmi_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/memcached_exporter/meta/main.yml b/roles/memcached_exporter/meta/main.yml index 19042e3a3..8730eacbc 100644 --- a/roles/memcached_exporter/meta/main.yml +++ b/roles/memcached_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/mongodb_exporter/meta/main.yml b/roles/mongodb_exporter/meta/main.yml index 4deb45508..8a50e17a2 100644 --- a/roles/mongodb_exporter/meta/main.yml +++ b/roles/mongodb_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/mysqld_exporter/meta/main.yml b/roles/mysqld_exporter/meta/main.yml index 1599aa329..975621f85 100644 --- a/roles/mysqld_exporter/meta/main.yml +++ b/roles/mysqld_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/nginx_exporter/meta/main.yml b/roles/nginx_exporter/meta/main.yml index 6871cc7a9..f25bbfdee 100644 --- a/roles/nginx_exporter/meta/main.yml +++ b/roles/nginx_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/node_exporter/meta/main.yml b/roles/node_exporter/meta/main.yml index 56cc5cccb..d6f5e1ddb 100644 --- a/roles/node_exporter/meta/main.yml +++ b/roles/node_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/postgres_exporter/meta/main.yml b/roles/postgres_exporter/meta/main.yml index 5652ac239..b194ff29b 100644 --- a/roles/postgres_exporter/meta/main.yml +++ b/roles/postgres_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/process_exporter/meta/main.yml b/roles/process_exporter/meta/main.yml index 3c4cc00d5..d7d94119d 100644 --- a/roles/process_exporter/meta/main.yml +++ b/roles/process_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/prometheus/meta/main.yml b/roles/prometheus/meta/main.yml index a71fd5f71..5ca700deb 100644 --- a/roles/prometheus/meta/main.yml +++ b/roles/prometheus/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/pushgateway/meta/main.yml b/roles/pushgateway/meta/main.yml index ad9360e8c..e4fad4e8a 100644 --- a/roles/pushgateway/meta/main.yml +++ b/roles/pushgateway/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/redis_exporter/meta/main.yml b/roles/redis_exporter/meta/main.yml index 44541fd09..8e566b4fb 100644 --- a/roles/redis_exporter/meta/main.yml +++ b/roles/redis_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/smartctl_exporter/meta/main.yml b/roles/smartctl_exporter/meta/main.yml index c69456584..c9a5927c9 100644 --- a/roles/smartctl_exporter/meta/main.yml +++ b/roles/smartctl_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/smokeping_prober/meta/main.yml b/roles/smokeping_prober/meta/main.yml index 8d8a895d8..1f0d93510 100644 --- a/roles/smokeping_prober/meta/main.yml +++ b/roles/smokeping_prober/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/snmp_exporter/meta/main.yml b/roles/snmp_exporter/meta/main.yml index ce60ad1b2..a264c489f 100644 --- a/roles/snmp_exporter/meta/main.yml +++ b/roles/snmp_exporter/meta/main.yml @@ -14,7 +14,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" diff --git a/roles/systemd_exporter/meta/main.yml b/roles/systemd_exporter/meta/main.yml index 2bd56f943..1a859f702 100644 --- a/roles/systemd_exporter/meta/main.yml +++ b/roles/systemd_exporter/meta/main.yml @@ -15,7 +15,6 @@ galaxy_info: - "bullseye" - name: "EL" versions: - - "7" - "8" - "9" - name: "Fedora" From 93d4e2b672dbc23869016ccf187ec3263c31ac24 Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 1 Jul 2024 13:13:00 +0000 Subject: [PATCH 03/13] fix: replace EOL Fedora versions with current ones Signed-off-by: gardar --- .config/molecule/config.yml | 8 ++++---- roles/alertmanager/meta/main.yml | 4 ++-- roles/bind_exporter/meta/main.yml | 4 ++-- roles/blackbox_exporter/meta/main.yml | 4 ++-- roles/cadvisor/meta/main.yml | 4 ++-- roles/chrony_exporter/meta/main.yml | 4 ++-- roles/fail2ban_exporter/meta/main.yml | 4 ++-- roles/ipmi_exporter/meta/main.yml | 4 ++-- roles/memcached_exporter/meta/main.yml | 4 ++-- roles/mongodb_exporter/meta/main.yml | 4 ++-- roles/mysqld_exporter/meta/main.yml | 4 ++-- roles/nginx_exporter/meta/main.yml | 4 ++-- roles/node_exporter/meta/main.yml | 4 ++-- roles/postgres_exporter/meta/main.yml | 4 ++-- roles/process_exporter/meta/main.yml | 4 ++-- roles/prometheus/meta/main.yml | 4 ++-- roles/pushgateway/meta/main.yml | 4 ++-- roles/redis_exporter/meta/main.yml | 4 ++-- roles/smartctl_exporter/meta/main.yml | 4 ++-- roles/smokeping_prober/meta/main.yml | 4 ++-- roles/snmp_exporter/meta/main.yml | 4 ++-- roles/systemd_exporter/meta/main.yml | 4 ++-- 22 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index cd0195c32..9ad9a9d41 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -29,14 +29,14 @@ platforms: 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 diff --git a/roles/alertmanager/meta/main.yml b/roles/alertmanager/meta/main.yml index 4367ca0d4..644501108 100644 --- a/roles/alertmanager/meta/main.yml +++ b/roles/alertmanager/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/bind_exporter/meta/main.yml b/roles/bind_exporter/meta/main.yml index 9be3fdd28..c25c16a89 100644 --- a/roles/bind_exporter/meta/main.yml +++ b/roles/bind_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/blackbox_exporter/meta/main.yml b/roles/blackbox_exporter/meta/main.yml index 85d155199..ca6101338 100644 --- a/roles/blackbox_exporter/meta/main.yml +++ b/roles/blackbox_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "exporter" - "monitoring" diff --git a/roles/cadvisor/meta/main.yml b/roles/cadvisor/meta/main.yml index 1ad1bfcd8..b2623fbe2 100644 --- a/roles/cadvisor/meta/main.yml +++ b/roles/cadvisor/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/chrony_exporter/meta/main.yml b/roles/chrony_exporter/meta/main.yml index 80e274760..b4ab43de6 100644 --- a/roles/chrony_exporter/meta/main.yml +++ b/roles/chrony_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/fail2ban_exporter/meta/main.yml b/roles/fail2ban_exporter/meta/main.yml index 6ae349af1..5e12f8c8e 100644 --- a/roles/fail2ban_exporter/meta/main.yml +++ b/roles/fail2ban_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/ipmi_exporter/meta/main.yml b/roles/ipmi_exporter/meta/main.yml index 969700673..1b06084e8 100644 --- a/roles/ipmi_exporter/meta/main.yml +++ b/roles/ipmi_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/memcached_exporter/meta/main.yml b/roles/memcached_exporter/meta/main.yml index 8730eacbc..323a69370 100644 --- a/roles/memcached_exporter/meta/main.yml +++ b/roles/memcached_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/mongodb_exporter/meta/main.yml b/roles/mongodb_exporter/meta/main.yml index 8a50e17a2..4061a94df 100644 --- a/roles/mongodb_exporter/meta/main.yml +++ b/roles/mongodb_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/mysqld_exporter/meta/main.yml b/roles/mysqld_exporter/meta/main.yml index 975621f85..eb34e7c92 100644 --- a/roles/mysqld_exporter/meta/main.yml +++ b/roles/mysqld_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/nginx_exporter/meta/main.yml b/roles/nginx_exporter/meta/main.yml index f25bbfdee..c71e79ce4 100644 --- a/roles/nginx_exporter/meta/main.yml +++ b/roles/nginx_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/node_exporter/meta/main.yml b/roles/node_exporter/meta/main.yml index d6f5e1ddb..7f956b4c0 100644 --- a/roles/node_exporter/meta/main.yml +++ b/roles/node_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/postgres_exporter/meta/main.yml b/roles/postgres_exporter/meta/main.yml index b194ff29b..f5b748585 100644 --- a/roles/postgres_exporter/meta/main.yml +++ b/roles/postgres_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/process_exporter/meta/main.yml b/roles/process_exporter/meta/main.yml index d7d94119d..a6f618183 100644 --- a/roles/process_exporter/meta/main.yml +++ b/roles/process_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/prometheus/meta/main.yml b/roles/prometheus/meta/main.yml index 5ca700deb..43f3c5b87 100644 --- a/roles/prometheus/meta/main.yml +++ b/roles/prometheus/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/pushgateway/meta/main.yml b/roles/pushgateway/meta/main.yml index e4fad4e8a..314718922 100644 --- a/roles/pushgateway/meta/main.yml +++ b/roles/pushgateway/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/redis_exporter/meta/main.yml b/roles/redis_exporter/meta/main.yml index 8e566b4fb..bd6a18a29 100644 --- a/roles/redis_exporter/meta/main.yml +++ b/roles/redis_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/smartctl_exporter/meta/main.yml b/roles/smartctl_exporter/meta/main.yml index c9a5927c9..a330a3adb 100644 --- a/roles/smartctl_exporter/meta/main.yml +++ b/roles/smartctl_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/smokeping_prober/meta/main.yml b/roles/smokeping_prober/meta/main.yml index 1f0d93510..f5f478315 100644 --- a/roles/smokeping_prober/meta/main.yml +++ b/roles/smokeping_prober/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/snmp_exporter/meta/main.yml b/roles/snmp_exporter/meta/main.yml index a264c489f..b352e9f79 100644 --- a/roles/snmp_exporter/meta/main.yml +++ b/roles/snmp_exporter/meta/main.yml @@ -18,8 +18,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" diff --git a/roles/systemd_exporter/meta/main.yml b/roles/systemd_exporter/meta/main.yml index 1a859f702..0f81e3c86 100644 --- a/roles/systemd_exporter/meta/main.yml +++ b/roles/systemd_exporter/meta/main.yml @@ -19,8 +19,8 @@ galaxy_info: - "9" - name: "Fedora" versions: - - "37" - - '38' + - "39" + - "40" galaxy_tags: - "monitoring" - "prometheus" From 7be1f09b9c84a6015f8155f73d47039ee739733a Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 1 Jul 2024 13:29:37 +0000 Subject: [PATCH 04/13] fix: add Ubuntu 24.04 to supported platforms Signed-off-by: gardar --- .config/molecule/config.yml | 6 ++++++ roles/alertmanager/meta/main.yml | 1 + roles/bind_exporter/meta/main.yml | 1 + roles/blackbox_exporter/meta/main.yml | 1 + roles/cadvisor/meta/main.yml | 1 + roles/chrony_exporter/meta/main.yml | 1 + roles/fail2ban_exporter/meta/main.yml | 1 + roles/ipmi_exporter/meta/main.yml | 1 + roles/memcached_exporter/meta/main.yml | 1 + roles/mongodb_exporter/meta/main.yml | 1 + roles/mysqld_exporter/meta/main.yml | 1 + roles/nginx_exporter/meta/main.yml | 1 + roles/node_exporter/meta/main.yml | 1 + roles/postgres_exporter/meta/main.yml | 1 + roles/process_exporter/meta/main.yml | 1 + roles/prometheus/meta/main.yml | 1 + roles/pushgateway/meta/main.yml | 1 + roles/redis_exporter/meta/main.yml | 1 + roles/smartctl_exporter/meta/main.yml | 1 + roles/smokeping_prober/meta/main.yml | 1 + roles/snmp_exporter/meta/main.yml | 1 + roles/systemd_exporter/meta/main.yml | 1 + 22 files changed, 27 insertions(+) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 9ad9a9d41..472871685 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -53,6 +53,12 @@ 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: diff --git a/roles/alertmanager/meta/main.yml b/roles/alertmanager/meta/main.yml index 644501108..949cbe134 100644 --- a/roles/alertmanager/meta/main.yml +++ b/roles/alertmanager/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/bind_exporter/meta/main.yml b/roles/bind_exporter/meta/main.yml index c25c16a89..13277846b 100644 --- a/roles/bind_exporter/meta/main.yml +++ b/roles/bind_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/blackbox_exporter/meta/main.yml b/roles/blackbox_exporter/meta/main.yml index ca6101338..55710458b 100644 --- a/roles/blackbox_exporter/meta/main.yml +++ b/roles/blackbox_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/cadvisor/meta/main.yml b/roles/cadvisor/meta/main.yml index b2623fbe2..a393540ed 100644 --- a/roles/cadvisor/meta/main.yml +++ b/roles/cadvisor/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/chrony_exporter/meta/main.yml b/roles/chrony_exporter/meta/main.yml index b4ab43de6..d175af47e 100644 --- a/roles/chrony_exporter/meta/main.yml +++ b/roles/chrony_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/fail2ban_exporter/meta/main.yml b/roles/fail2ban_exporter/meta/main.yml index 5e12f8c8e..09e602016 100644 --- a/roles/fail2ban_exporter/meta/main.yml +++ b/roles/fail2ban_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/ipmi_exporter/meta/main.yml b/roles/ipmi_exporter/meta/main.yml index 1b06084e8..af60f050a 100644 --- a/roles/ipmi_exporter/meta/main.yml +++ b/roles/ipmi_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/memcached_exporter/meta/main.yml b/roles/memcached_exporter/meta/main.yml index 323a69370..8fff353d4 100644 --- a/roles/memcached_exporter/meta/main.yml +++ b/roles/memcached_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/mongodb_exporter/meta/main.yml b/roles/mongodb_exporter/meta/main.yml index 4061a94df..bd4bb0405 100644 --- a/roles/mongodb_exporter/meta/main.yml +++ b/roles/mongodb_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/mysqld_exporter/meta/main.yml b/roles/mysqld_exporter/meta/main.yml index eb34e7c92..84c3a47c8 100644 --- a/roles/mysqld_exporter/meta/main.yml +++ b/roles/mysqld_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/nginx_exporter/meta/main.yml b/roles/nginx_exporter/meta/main.yml index c71e79ce4..ad376e7eb 100644 --- a/roles/nginx_exporter/meta/main.yml +++ b/roles/nginx_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/node_exporter/meta/main.yml b/roles/node_exporter/meta/main.yml index 7f956b4c0..ee5c71ea4 100644 --- a/roles/node_exporter/meta/main.yml +++ b/roles/node_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/postgres_exporter/meta/main.yml b/roles/postgres_exporter/meta/main.yml index f5b748585..620b4733e 100644 --- a/roles/postgres_exporter/meta/main.yml +++ b/roles/postgres_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/process_exporter/meta/main.yml b/roles/process_exporter/meta/main.yml index a6f618183..dab8709c1 100644 --- a/roles/process_exporter/meta/main.yml +++ b/roles/process_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/prometheus/meta/main.yml b/roles/prometheus/meta/main.yml index 43f3c5b87..355c8a5eb 100644 --- a/roles/prometheus/meta/main.yml +++ b/roles/prometheus/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/pushgateway/meta/main.yml b/roles/pushgateway/meta/main.yml index 314718922..f6371cf17 100644 --- a/roles/pushgateway/meta/main.yml +++ b/roles/pushgateway/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/redis_exporter/meta/main.yml b/roles/redis_exporter/meta/main.yml index bd6a18a29..685122ab3 100644 --- a/roles/redis_exporter/meta/main.yml +++ b/roles/redis_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/smartctl_exporter/meta/main.yml b/roles/smartctl_exporter/meta/main.yml index a330a3adb..750437e1a 100644 --- a/roles/smartctl_exporter/meta/main.yml +++ b/roles/smartctl_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/smokeping_prober/meta/main.yml b/roles/smokeping_prober/meta/main.yml index f5f478315..1882e861f 100644 --- a/roles/smokeping_prober/meta/main.yml +++ b/roles/smokeping_prober/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/snmp_exporter/meta/main.yml b/roles/snmp_exporter/meta/main.yml index b352e9f79..f356bb203 100644 --- a/roles/snmp_exporter/meta/main.yml +++ b/roles/snmp_exporter/meta/main.yml @@ -9,6 +9,7 @@ galaxy_info: versions: - "focal" - "jammy" + - "noble" - name: "Debian" versions: - "bullseye" diff --git a/roles/systemd_exporter/meta/main.yml b/roles/systemd_exporter/meta/main.yml index 0f81e3c86..b3cd6f425 100644 --- a/roles/systemd_exporter/meta/main.yml +++ b/roles/systemd_exporter/meta/main.yml @@ -10,6 +10,7 @@ galaxy_info: - "focal" - "jammy" - "xenial" + - "noble" - name: "Debian" versions: - "bullseye" From 3fca70519c451c5da1e86396a0f66197de7c4837 Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 16 Sep 2024 16:45:57 +0000 Subject: [PATCH 05/13] fix(molecule): skip testing eol ansible versions on incompatible distros Signed-off-by: gardar --- .config/molecule/config.yml | 20 ++++++++++++++++++++ .config/molecule/converge.yml | 28 +++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 472871685..db338a1cf 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -64,3 +64,23 @@ verifier: 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" diff --git a/.config/molecule/converge.yml b/.config/molecule/converge.yml index 87aff542a..d1c3ef7e3 100644 --- a/.config/molecule/converge.yml +++ b/.config/molecule/converge.yml @@ -1,6 +1,32 @@ --- +- 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'] + - name: Converge - hosts: all + hosts: target_hosts any_errors_fatal: true tasks: - name: "Run role" From 2d2e0ebb1916ace775854effbf84557d1a8fc6a2 Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 16 Sep 2024 17:27:14 +0000 Subject: [PATCH 06/13] fix: idempotency in add_host Signed-off-by: gardar --- .config/molecule/converge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/molecule/converge.yml b/.config/molecule/converge.yml index d1c3ef7e3..4d9c81218 100644 --- a/.config/molecule/converge.yml +++ b/.config/molecule/converge.yml @@ -24,6 +24,7 @@ ) }} when: item not in groups['target_hosts'] + changed_when: false - name: Converge hosts: target_hosts From c59483a92f372885761b48f64394a59a8568d2b8 Mon Sep 17 00:00:00 2001 From: gardar Date: Mon, 16 Sep 2024 17:42:03 +0000 Subject: [PATCH 07/13] refactor: make systemd_exporter molecule config be in line with other roles Signed-off-by: gardar --- roles/systemd_exporter/molecule/default/molecule.yml | 3 ++- roles/systemd_exporter/molecule/default/playbook.yml | 8 -------- roles/systemd_exporter/molecule/latest/molecule.yml | 3 ++- roles/systemd_exporter/molecule/latest/playbook.yml | 8 -------- 4 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 roles/systemd_exporter/molecule/default/playbook.yml delete mode 100644 roles/systemd_exporter/molecule/latest/playbook.yml diff --git a/roles/systemd_exporter/molecule/default/molecule.yml b/roles/systemd_exporter/molecule/default/molecule.yml index 5874a762e..93423d98d 100644 --- a/roles/systemd_exporter/molecule/default/molecule.yml +++ b/roles/systemd_exporter/molecule/default/molecule.yml @@ -2,4 +2,5 @@ provisioner: inventory: group_vars: - all: {} + all: + systemd_exporter_web_listen_address: "127.0.0.1:9558" diff --git a/roles/systemd_exporter/molecule/default/playbook.yml b/roles/systemd_exporter/molecule/default/playbook.yml deleted file mode 100644 index 88cf6e971..000000000 --- a/roles/systemd_exporter/molecule/default/playbook.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Run role - hosts: all - any_errors_fatal: true - roles: - - prometheus.prometheus.systemd_exporter - vars: - systemd_exporter_web_listen_address: "127.0.0.1:9558" diff --git a/roles/systemd_exporter/molecule/latest/molecule.yml b/roles/systemd_exporter/molecule/latest/molecule.yml index 5874a762e..9cbfc8446 100644 --- a/roles/systemd_exporter/molecule/latest/molecule.yml +++ b/roles/systemd_exporter/molecule/latest/molecule.yml @@ -2,4 +2,5 @@ provisioner: inventory: group_vars: - all: {} + all: + systemd_exporter_version: latest diff --git a/roles/systemd_exporter/molecule/latest/playbook.yml b/roles/systemd_exporter/molecule/latest/playbook.yml deleted file mode 100644 index 2bde8cf06..000000000 --- a/roles/systemd_exporter/molecule/latest/playbook.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Run role - hosts: all - any_errors_fatal: true - roles: - - prometheus.prometheus.systemd_exporter - vars: - systemd_exporter_version: latest From b471a1f4a4b749d7426e7d993d06e48bd9a54cc8 Mon Sep 17 00:00:00 2001 From: gardar Date: Wed, 18 Sep 2024 03:49:54 +0000 Subject: [PATCH 08/13] test: unified prepare playbook for alternative molecule scenarios Signed-off-by: gardar --- .config/molecule/alternative/prepare.yml | 104 ++++++++++++++++++ .../molecule/alternative/molecule.yml | 4 + .../molecule/alternative/molecule.yml | 5 + .../molecule/alternative/molecule.yml | 3 + .../molecule/alternative/molecule.yml | 5 +- .../molecule/alternative/molecule.yml | 4 + .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 5 +- .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 5 +- .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 5 + .../molecule/alternative/molecule.yml | 4 + .../molecule/alternative/molecule.yml | 4 + .../molecule/alternative/molecule.yml | 14 ++- .../molecule/alternative/molecule.yml | 6 +- .../molecule/alternative/molecule.yml | 6 + .../molecule/alternative/molecule.yml | 5 + 20 files changed, 196 insertions(+), 13 deletions(-) create mode 100644 .config/molecule/alternative/prepare.yml diff --git a/.config/molecule/alternative/prepare.yml b/.config/molecule/alternative/prepare.yml new file mode 100644 index 000000000..1eeadc414 --- /dev/null +++ b/.config/molecule/alternative/prepare.yml @@ -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 }}" diff --git a/roles/alertmanager/molecule/alternative/molecule.yml b/roles/alertmanager/molecule/alternative/molecule.yml index fc61e33ad..70f0d82df 100644 --- a/roles/alertmanager/molecule/alternative/molecule.yml +++ b/roles/alertmanager/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -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" diff --git a/roles/bind_exporter/molecule/alternative/molecule.yml b/roles/bind_exporter/molecule/alternative/molecule.yml index ad910d835..ddd0ed6f6 100644 --- a/roles/bind_exporter/molecule/alternative/molecule.yml +++ b/roles/bind_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: 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" diff --git a/roles/cadvisor/molecule/alternative/molecule.yml b/roles/cadvisor/molecule/alternative/molecule.yml index 898ee4fd3..50e63c385 100644 --- a/roles/cadvisor/molecule/alternative/molecule.yml +++ b/roles/cadvisor/molecule/alternative/molecule.yml @@ -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 diff --git a/roles/chrony_exporter/molecule/alternative/molecule.yml b/roles/chrony_exporter/molecule/alternative/molecule.yml index 8f0fdf709..6e55e96e5 100644 --- a/roles/chrony_exporter/molecule/alternative/molecule.yml +++ b/roles/chrony_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: 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 @@ -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" diff --git a/roles/fail2ban_exporter/molecule/alternative/molecule.yml b/roles/fail2ban_exporter/molecule/alternative/molecule.yml index 216671a48..182b6776f 100644 --- a/roles/fail2ban_exporter/molecule/alternative/molecule.yml +++ b/roles/fail2ban_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -7,3 +9,5 @@ provisioner: fail2ban_exporter_web_listen_address: "127.0.1.1:9191" go_arch: amd64 fail2ban_exporter_version: 0.10.1 + fail2ban_exporter_binary_url: "https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/releases/v{{ fail2ban_exporter_version }}/downloads/\ + fail2ban_exporter_{{ fail2ban_exporter_version }}_linux_{{ go_arch }}.tar.gz" diff --git a/roles/ipmi_exporter/molecule/alternative/molecule.yml b/roles/ipmi_exporter/molecule/alternative/molecule.yml index 939429559..d997bc7f0 100644 --- a/roles/ipmi_exporter/molecule/alternative/molecule.yml +++ b/roles/ipmi_exporter/molecule/alternative/molecule.yml @@ -1,11 +1,12 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: ipmi_exporter_binary_local_dir: "/tmp/ipmi_exporter-linux-amd64" ipmi_exporter_web_listen_address: "127.0.0.1:8080" - ipmi_exporter_tls_server_config: cert_file: /etc/ipmi_exporter/tls.cert key_file: /etc/ipmi_exporter/tls.key @@ -15,3 +16,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 ipmi_exporter_version: 1.6.1 + ipmi_exporter_binary_url: "https://github.com/prometheus-community/ipmi_exporter/releases/download/v{{\ + \ ipmi_exporter_version }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/memcached_exporter/molecule/alternative/molecule.yml b/roles/memcached_exporter/molecule/alternative/molecule.yml index db81a1f66..421307617 100644 --- a/roles/memcached_exporter/molecule/alternative/molecule.yml +++ b/roles/memcached_exporter/molecule/alternative/molecule.yml @@ -1,11 +1,12 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: memcached_exporter_binary_local_dir: "/tmp/memcached_exporter-linux-amd64" memcached_exporter_web_listen_address: "127.0.0.1:8080" - memcached_exporter_tls_server_config: cert_file: /etc/memcached_exporter/tls.cert key_file: /etc/memcached_exporter/tls.key @@ -15,3 +16,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 memcached_exporter_version: 0.12.0 + memcached_exporter_binary_url: "https://github.com/prometheus/memcached_exporter/releases/download/v{{\ + \ memcached_exporter_version }}/memcached_exporter-{{ memcached_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/mongodb_exporter/molecule/alternative/molecule.yml b/roles/mongodb_exporter/molecule/alternative/molecule.yml index c9807730a..0e14d811a 100644 --- a/roles/mongodb_exporter/molecule/alternative/molecule.yml +++ b/roles/mongodb_exporter/molecule/alternative/molecule.yml @@ -1,11 +1,12 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: mongodb_exporter_binary_local_dir: "/tmp/mongodb_exporter-linux-amd64_local" mongodb_exporter_web_listen_address: "127.0.1.1:9216" - mongodb_exporter_tls_server_config: cert_file: /etc/mongodb_exporter/tls.cert key_file: /etc/mongodb_exporter/tls.key @@ -15,3 +16,5 @@ provisioner: randomuser: examplepassword go_arch: amd64 mongodb_exporter_version: 0.40.0 + mongodb_exporter_binary_url: "https://github.com/percona/mongodb_exporter/releases/download/v{{ mongodb_exporter_version }}/\ + mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}.tar.gz" diff --git a/roles/mysqld_exporter/molecule/alternative/molecule.yml b/roles/mysqld_exporter/molecule/alternative/molecule.yml index b5a4cec86..153959e8c 100644 --- a/roles/mysqld_exporter/molecule/alternative/molecule.yml +++ b/roles/mysqld_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -11,7 +13,6 @@ provisioner: - slave_hosts mysqld_exporter_disabled_collectors: - global_variables - mysqld_exporter_tls_server_config: cert_file: /etc/mysqld_exporter/tls.cert key_file: /etc/mysqld_exporter/tls.key @@ -21,3 +22,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 mysqld_exporter_version: 0.15.0 + mysqld_exporter_binary_url: "https://github.com/prometheus/mysqld_exporter/releases/download/v{{\ + \ mysqld_exporter_version }}/mysqld_exporter-{{ mysqld_exporter_version\ + \ }}.linux-{{ go_arch }}.tar.gz" diff --git a/roles/nginx_exporter/molecule/alternative/molecule.yml b/roles/nginx_exporter/molecule/alternative/molecule.yml index 4b42c1838..8ae883942 100644 --- a/roles/nginx_exporter/molecule/alternative/molecule.yml +++ b/roles/nginx_exporter/molecule/alternative/molecule.yml @@ -1,11 +1,12 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: nginx_exporter_binary_local_dir: "/tmp/nginx_exporter-linux-amd64_local" nginx_exporter_web_listen_address: "127.0.0.1:9113" - nginx_exporter_tls_server_config: cert_file: /etc/nginx_exporter/tls.cert key_file: /etc/nginx_exporter/tls.key @@ -15,3 +16,5 @@ provisioner: randomuser: examplepassword go_arch: amd64 nginx_exporter_version: 1.1.0 + nginx_exporter_binary_url: "https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v{{ nginx_exporter_version }}/\ + nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_{{ go_arch }}.tar.gz" diff --git a/roles/node_exporter/molecule/alternative/molecule.yml b/roles/node_exporter/molecule/alternative/molecule.yml index a9d1c7a69..508f9af12 100644 --- a/roles/node_exporter/molecule/alternative/molecule.yml +++ b/roles/node_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -12,7 +14,6 @@ provisioner: - entropy node_exporter_disabled_collectors: - diskstats - node_exporter_tls_server_config: cert_file: /etc/node_exporter/tls.cert key_file: /etc/node_exporter/tls.key @@ -22,3 +23,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 node_exporter_version: 1.5.0 + node_exporter_binary_url: "https://github.com/prometheus/node_exporter/releases/download/v{{\ + \ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/postgres_exporter/molecule/alternative/molecule.yml b/roles/postgres_exporter/molecule/alternative/molecule.yml index 4a8d5da49..da17a5945 100644 --- a/roles/postgres_exporter/molecule/alternative/molecule.yml +++ b/roles/postgres_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -11,7 +13,6 @@ provisioner: - postmaster postgres_exporter_disabled_collectors: - replication - postgres_exporter_tls_server_config: cert_file: /etc/postgres_exporter/tls.cert key_file: /etc/postgres_exporter/tls.key @@ -21,3 +22,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 postgres_exporter_version: 0.15.0 + postgres_exporter_binary_url: "https://github.com/prometheus-community/postgres_exporter/releases/download/v{{\ + \ postgres_exporter_version }}/postgres_exporter-{{ postgres_exporter_version\ + \ }}.linux-{{ go_arch }}.tar.gz" diff --git a/roles/process_exporter/molecule/alternative/molecule.yml b/roles/process_exporter/molecule/alternative/molecule.yml index 8b6b51fc4..4d9c97d70 100644 --- a/roles/process_exporter/molecule/alternative/molecule.yml +++ b/roles/process_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -26,3 +28,6 @@ provisioner: cmdline: - crond {% endraw %} + process_exporter_binary_url: "https://github.com/ncabatoff/process-exporter/releases/download/v{{\ + \ process_exporter_version }}/process-exporter-{{ process_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/prometheus/molecule/alternative/molecule.yml b/roles/prometheus/molecule/alternative/molecule.yml index e8d44cbfe..76c708494 100644 --- a/roles/prometheus/molecule/alternative/molecule.yml +++ b/roles/prometheus/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -88,3 +90,5 @@ provisioner: replacement: 127.0.0.1:9115 # Blackbox exporter. prometheus_version: 2.25.2 prometheus_stop_timeout: 1min + prometheus_binary_url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version\ + \ }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz" diff --git a/roles/pushgateway/molecule/alternative/molecule.yml b/roles/pushgateway/molecule/alternative/molecule.yml index e0534421d..ab4b97bbe 100644 --- a/roles/pushgateway/molecule/alternative/molecule.yml +++ b/roles/pushgateway/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -16,3 +18,5 @@ provisioner: randomuser: examplepassword go_arch: amd64 pushgateway_version: 1.5.1 + pushgateway_binary_url: "https://github.com/prometheus/pushgateway/releases/download/v{{ pushgateway_version\ + \ }}/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch }}.tar.gz" diff --git a/roles/redis_exporter/molecule/alternative/molecule.yml b/roles/redis_exporter/molecule/alternative/molecule.yml index b0120f9f0..959161705 100644 --- a/roles/redis_exporter/molecule/alternative/molecule.yml +++ b/roles/redis_exporter/molecule/alternative/molecule.yml @@ -1,13 +1,19 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: redis_exporter_binary_local_dir: "/tmp/redis_exporter-linux-amd64" redis_exporter_web_listen_address: "127.0.0.1:8080" - - redis_exporter_tls_server_ca_cert_file: /etc/redis_exporter/tls.cert - redis_exporter_tls_server_cert_file: /etc/redis_exporter/tls.cert - redis_exporter_tls_server_key_file: /etc/redis_exporter/tls.key + redis_exporter_tls_server_config: + cert_file: /etc/redis_exporter/tls.cert + key_file: /etc/redis_exporter/tls.key + redis_exporter_tls_server_cert_file: "{{ redis_exporter_tls_server_config.cert_file }}" + redis_exporter_tls_server_key_file: "{{ redis_exporter_tls_server_config.key_file }}" go_arch: amd64 redis_exporter_version: 1.58.0 + redis_exporter_binary_url: "https://github.com/oliver006/redis_exporter/releases/download/v{{\ + \ redis_exporter_version }}/redis_exporter-v{{ redis_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/smartctl_exporter/molecule/alternative/molecule.yml b/roles/smartctl_exporter/molecule/alternative/molecule.yml index 38c6ec552..fa83c8f65 100644 --- a/roles/smartctl_exporter/molecule/alternative/molecule.yml +++ b/roles/smartctl_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -9,7 +11,6 @@ provisioner: smartctl_exporter_smartctl_rescan: "5m" smartctl_exporter_smartctl_device_include: "/dev/sda" smartctl_exporter_smartctl_device_exclude: "/dev/sdb" - smartctl_exporter_tls_server_config: cert_file: /etc/smartctl_exporter/tls.cert key_file: /etc/smartctl_exporter/tls.key @@ -19,3 +20,6 @@ provisioner: randomuser: examplepassword go_arch: amd64 smartctl_exporter_version: 0.11.0 + smartctl_exporter_binary_url: "https://github.com/prometheus-community/smartctl_exporter/releases/download/v{{\ + \ smartctl_exporter_version }}/smartctl_exporter-{{ smartctl_exporter_version }}.linux-{{\ + \ go_arch }}.tar.gz" diff --git a/roles/smokeping_prober/molecule/alternative/molecule.yml b/roles/smokeping_prober/molecule/alternative/molecule.yml index cc00e9e96..726710555 100644 --- a/roles/smokeping_prober/molecule/alternative/molecule.yml +++ b/roles/smokeping_prober/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -16,3 +18,7 @@ provisioner: randomuser: examplepassword go_arch: amd64 smokeping_prober_version: 0.7.0 + smokeping_prober_archive_path: /tmp + smokeping_archive_path: /tmp + smokeping_prober_binary_url: "https://github.com/superq/smokeping_prober/releases/download/v{{ smokeping_prober_version\ + \ }}/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch }}.tar.gz" diff --git a/roles/systemd_exporter/molecule/alternative/molecule.yml b/roles/systemd_exporter/molecule/alternative/molecule.yml index 17c10dfff..d33138d8f 100644 --- a/roles/systemd_exporter/molecule/alternative/molecule.yml +++ b/roles/systemd_exporter/molecule/alternative/molecule.yml @@ -1,5 +1,7 @@ --- provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" inventory: group_vars: all: @@ -11,3 +13,6 @@ provisioner: cert_file: /etc/systemd_exporter/tls.cert key_file: /etc/systemd_exporter/tls.key systemd_exporter_enable_file_descriptor_size: true + systemd_exporter_binary_url: "https://github.com/prometheus-community/systemd_exporter/releases/download/v{{\ + \ systemd_exporter_version }}/systemd_exporter-{{ systemd_exporter_version\ + \ }}.linux-{{ go_arch }}.tar.gz" From 3b679c9161edefc76762280d541dfb9b32293efe Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 20 Sep 2024 19:48:18 +0000 Subject: [PATCH 09/13] fix: skip running testinfra on excluded ansible versions Signed-off-by: gardar --- .config/molecule/config.yml | 2 + .testinfra/testinfra_helpers.py | 67 +++++++++++++++++++ .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_alternative.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_alternative.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../agentmode/tests/test_agentmode.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_alternative.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_alternative.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- .../alternative/tests/test_alternative.py | 6 +- .../molecule/default/tests/test_default.py | 6 +- .../molecule/latest/tests/test_latest.py | 6 +- 66 files changed, 197 insertions(+), 256 deletions(-) create mode 100644 .testinfra/testinfra_helpers.py diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index db338a1cf..5bb016d9b 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -61,6 +61,8 @@ platforms: command: /lib/systemd/systemd verifier: name: testinfra + additional_files_or_dirs: + - "../../../../../.testinfra/testinfra_helpers.py" provisioner: playbooks: converge: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/converge.yml" diff --git a/.testinfra/testinfra_helpers.py b/.testinfra/testinfra_helpers.py new file mode 100644 index 000000000..962f465e3 --- /dev/null +++ b/.testinfra/testinfra_helpers.py @@ -0,0 +1,67 @@ +import os +import testinfra + + +def get_ansible_version(): + """ + Get the current Ansible version from localhost using the 'debug' module. + + Returns: + str: The current Ansible version (major.minor). + """ + localhost = testinfra.get_host( + "ansible://localhost?ansible_inventory=localhost," + ) + local_ansible_version = localhost.ansible("debug", "var=ansible_version") + ansible_version = '.'.join( + local_ansible_version['ansible_version']['full'].split('.')[:2] + ) + return ansible_version + + +def filter_compatible_hosts(inventory, ansible_version): + """ + Filter hosts based on Ansible version compatibility. + + Args: + inventory (str): The inventory file path. + ansible_version (str): The current Ansible version (major.minor). + + Returns: + list: A list of compatible hosts that do not have the current Ansible + version in their exclude_ansible_vers hostvars. + """ + ansible_runner = testinfra.utils.ansible_runner.AnsibleRunner(inventory) + all_hosts = ansible_runner.get_hosts('all') + compatible_hosts = [] + + for host in all_hosts: + # Get host variables + host_vars = ansible_runner.get_variables(host) + + # Check if the host should be excluded + if 'exclude_ansible_vers' in host_vars: + excluded_versions = host_vars['exclude_ansible_vers'] + if ansible_version in excluded_versions: + continue + compatible_hosts.append(host) + + return compatible_hosts + + +def get_target_hosts(): + """ + Get the filtered target hosts based on the current Ansible version. + + Returns: + list: A list of hosts that are compatible with + the current Ansible version. + """ + # Get current Ansible version + current_ansible_version = get_ansible_version() + + # Get the inventory file from environment + inventory_file = os.environ['MOLECULE_INVENTORY_FILE'] + + # Filter the hosts based on the exclusion criteria + return filter_compatible_hosts(inventory_file, current_ansible_version) diff --git a/roles/alertmanager/molecule/alternative/tests/test_alternative.py b/roles/alertmanager/molecule/alternative/tests/test_alternative.py index 8326c05f7..bfc3eba1b 100644 --- a/roles/alertmanager/molecule/alternative/tests/test_alternative.py +++ b/roles/alertmanager/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("dirs", [ diff --git a/roles/alertmanager/molecule/default/tests/test_default.py b/roles/alertmanager/molecule/default/tests/test_default.py index 15a360e58..1f2599c27 100644 --- a/roles/alertmanager/molecule/default/tests/test_default.py +++ b/roles/alertmanager/molecule/default/tests/test_default.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner import pytest +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("dirs", [ diff --git a/roles/alertmanager/molecule/latest/tests/test_latest.py b/roles/alertmanager/molecule/latest/tests/test_latest.py index bd4aa1b27..c328ed750 100644 --- a/roles/alertmanager/molecule/latest/tests/test_latest.py +++ b/roles/alertmanager/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/bind_exporter/molecule/alternative/tests/test_alternative.py b/roles/bind_exporter/molecule/alternative/tests/test_alternative.py index 18ea53deb..47703c404 100644 --- a/roles/bind_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/bind_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/bind_exporter/molecule/default/tests/test_default.py b/roles/bind_exporter/molecule/default/tests/test_default.py index 64e8251ed..18b149e70 100644 --- a/roles/bind_exporter/molecule/default/tests/test_default.py +++ b/roles/bind_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/bind_exporter/molecule/latest/tests/test_latest.py b/roles/bind_exporter/molecule/latest/tests/test_latest.py index dc9e04034..1ba88f86e 100644 --- a/roles/bind_exporter/molecule/latest/tests/test_latest.py +++ b/roles/bind_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/blackbox_exporter/molecule/alternative/tests/test_alternative.py b/roles/blackbox_exporter/molecule/alternative/tests/test_alternative.py index 5d4fb2ed5..680b2f16f 100644 --- a/roles/blackbox_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/blackbox_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/blackbox_exporter/molecule/default/tests/test_default.py b/roles/blackbox_exporter/molecule/default/tests/test_default.py index b54460a90..7787cac6e 100644 --- a/roles/blackbox_exporter/molecule/default/tests/test_default.py +++ b/roles/blackbox_exporter/molecule/default/tests/test_default.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/blackbox_exporter/molecule/latest/tests/test_latest.py b/roles/blackbox_exporter/molecule/latest/tests/test_latest.py index 8b5955eac..65f093e95 100644 --- a/roles/blackbox_exporter/molecule/latest/tests/test_latest.py +++ b/roles/blackbox_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/cadvisor/molecule/alternative/tests/test_alternative.py b/roles/cadvisor/molecule/alternative/tests/test_alternative.py index 39272e9b4..fdd117589 100644 --- a/roles/cadvisor/molecule/alternative/tests/test_alternative.py +++ b/roles/cadvisor/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/cadvisor/molecule/default/tests/test_default.py b/roles/cadvisor/molecule/default/tests/test_default.py index 3d58b223c..c4f240f44 100644 --- a/roles/cadvisor/molecule/default/tests/test_default.py +++ b/roles/cadvisor/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_files(host): diff --git a/roles/cadvisor/molecule/latest/tests/test_alternative.py b/roles/cadvisor/molecule/latest/tests/test_alternative.py index 966c1141f..11fb025e0 100644 --- a/roles/cadvisor/molecule/latest/tests/test_alternative.py +++ b/roles/cadvisor/molecule/latest/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/chrony_exporter/molecule/alternative/tests/test_alternative.py b/roles/chrony_exporter/molecule/alternative/tests/test_alternative.py index b8714e1d8..34b5c1694 100644 --- a/roles/chrony_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/chrony_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/chrony_exporter/molecule/default/tests/test_default.py b/roles/chrony_exporter/molecule/default/tests/test_default.py index bceddff05..f3d272a1b 100644 --- a/roles/chrony_exporter/molecule/default/tests/test_default.py +++ b/roles/chrony_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/chrony_exporter/molecule/latest/tests/test_alternative.py b/roles/chrony_exporter/molecule/latest/tests/test_alternative.py index a3131111f..ee22dc06c 100644 --- a/roles/chrony_exporter/molecule/latest/tests/test_alternative.py +++ b/roles/chrony_exporter/molecule/latest/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/fail2ban_exporter/molecule/alternative/tests/test_alternative.py b/roles/fail2ban_exporter/molecule/alternative/tests/test_alternative.py index 35b1f4125..d13dfa005 100644 --- a/roles/fail2ban_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/fail2ban_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/fail2ban_exporter/molecule/default/tests/test_default.py b/roles/fail2ban_exporter/molecule/default/tests/test_default.py index d5448e538..2871795b9 100644 --- a/roles/fail2ban_exporter/molecule/default/tests/test_default.py +++ b/roles/fail2ban_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_files(host): diff --git a/roles/fail2ban_exporter/molecule/latest/tests/test_latest.py b/roles/fail2ban_exporter/molecule/latest/tests/test_latest.py index 4ce298bfb..3f88af7da 100644 --- a/roles/fail2ban_exporter/molecule/latest/tests/test_latest.py +++ b/roles/fail2ban_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/ipmi_exporter/molecule/alternative/tests/test_alternative.py b/roles/ipmi_exporter/molecule/alternative/tests/test_alternative.py index e673e56df..86b890125 100644 --- a/roles/ipmi_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/ipmi_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/ipmi_exporter/molecule/default/tests/test_default.py b/roles/ipmi_exporter/molecule/default/tests/test_default.py index fcd30e464..bcde01288 100644 --- a/roles/ipmi_exporter/molecule/default/tests/test_default.py +++ b/roles/ipmi_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/ipmi_exporter/molecule/latest/tests/test_latest.py b/roles/ipmi_exporter/molecule/latest/tests/test_latest.py index 0cfac4251..3636bd348 100644 --- a/roles/ipmi_exporter/molecule/latest/tests/test_latest.py +++ b/roles/ipmi_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/memcached_exporter/molecule/alternative/tests/test_alternative.py b/roles/memcached_exporter/molecule/alternative/tests/test_alternative.py index 288fbf8f4..2f1237089 100644 --- a/roles/memcached_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/memcached_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/memcached_exporter/molecule/default/tests/test_default.py b/roles/memcached_exporter/molecule/default/tests/test_default.py index 3e70a8b43..eeccbee9b 100644 --- a/roles/memcached_exporter/molecule/default/tests/test_default.py +++ b/roles/memcached_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/memcached_exporter/molecule/latest/tests/test_latest.py b/roles/memcached_exporter/molecule/latest/tests/test_latest.py index 700ad0f1d..ecd2e09fa 100644 --- a/roles/memcached_exporter/molecule/latest/tests/test_latest.py +++ b/roles/memcached_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/mongodb_exporter/molecule/alternative/tests/test_alternative.py b/roles/mongodb_exporter/molecule/alternative/tests/test_alternative.py index a102ea94f..66e009496 100644 --- a/roles/mongodb_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/mongodb_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/mongodb_exporter/molecule/default/tests/test_default.py b/roles/mongodb_exporter/molecule/default/tests/test_default.py index 53e3858d0..c8cf3caae 100644 --- a/roles/mongodb_exporter/molecule/default/tests/test_default.py +++ b/roles/mongodb_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/mongodb_exporter/molecule/latest/tests/test_latest.py b/roles/mongodb_exporter/molecule/latest/tests/test_latest.py index 7f6a621c2..07528b624 100644 --- a/roles/mongodb_exporter/molecule/latest/tests/test_latest.py +++ b/roles/mongodb_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/mysqld_exporter/molecule/alternative/tests/test_alternative.py b/roles/mysqld_exporter/molecule/alternative/tests/test_alternative.py index 734b97fbc..92a34c78f 100644 --- a/roles/mysqld_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/mysqld_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/mysqld_exporter/molecule/default/tests/test_default.py b/roles/mysqld_exporter/molecule/default/tests/test_default.py index 930779fb6..1bd8ac8a6 100644 --- a/roles/mysqld_exporter/molecule/default/tests/test_default.py +++ b/roles/mysqld_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/mysqld_exporter/molecule/latest/tests/test_latest.py b/roles/mysqld_exporter/molecule/latest/tests/test_latest.py index 56cec8c93..c5c21688f 100644 --- a/roles/mysqld_exporter/molecule/latest/tests/test_latest.py +++ b/roles/mysqld_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/nginx_exporter/molecule/alternative/tests/test_alternative.py b/roles/nginx_exporter/molecule/alternative/tests/test_alternative.py index 9f1e8e7da..8521755bd 100644 --- a/roles/nginx_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/nginx_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/nginx_exporter/molecule/default/tests/test_default.py b/roles/nginx_exporter/molecule/default/tests/test_default.py index 18339faee..d7c4a9fd4 100644 --- a/roles/nginx_exporter/molecule/default/tests/test_default.py +++ b/roles/nginx_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/nginx_exporter/molecule/latest/tests/test_latest.py b/roles/nginx_exporter/molecule/latest/tests/test_latest.py index 6dffb2c40..8a4545afa 100644 --- a/roles/nginx_exporter/molecule/latest/tests/test_latest.py +++ b/roles/nginx_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/node_exporter/molecule/alternative/tests/test_alternative.py b/roles/node_exporter/molecule/alternative/tests/test_alternative.py index 0d5b517bb..4d9f71086 100644 --- a/roles/node_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/node_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/node_exporter/molecule/default/tests/test_default.py b/roles/node_exporter/molecule/default/tests/test_default.py index 8ac237dad..24688320a 100644 --- a/roles/node_exporter/molecule/default/tests/test_default.py +++ b/roles/node_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/node_exporter/molecule/latest/tests/test_latest.py b/roles/node_exporter/molecule/latest/tests/test_latest.py index 812280205..41fbc5013 100644 --- a/roles/node_exporter/molecule/latest/tests/test_latest.py +++ b/roles/node_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/postgres_exporter/molecule/alternative/tests/test_alternative.py b/roles/postgres_exporter/molecule/alternative/tests/test_alternative.py index 113fd33c7..1d39feee3 100644 --- a/roles/postgres_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/postgres_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/postgres_exporter/molecule/default/tests/test_default.py b/roles/postgres_exporter/molecule/default/tests/test_default.py index d497d5b13..d2eb60d75 100644 --- a/roles/postgres_exporter/molecule/default/tests/test_default.py +++ b/roles/postgres_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/postgres_exporter/molecule/latest/tests/test_latest.py b/roles/postgres_exporter/molecule/latest/tests/test_latest.py index 2d8c9d499..5612095f2 100644 --- a/roles/postgres_exporter/molecule/latest/tests/test_latest.py +++ b/roles/postgres_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/process_exporter/molecule/alternative/tests/test_alternative.py b/roles/process_exporter/molecule/alternative/tests/test_alternative.py index 4922514b0..18ac0f169 100644 --- a/roles/process_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/process_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/process_exporter/molecule/default/tests/test_default.py b/roles/process_exporter/molecule/default/tests/test_default.py index 71ea4d365..066e268f2 100644 --- a/roles/process_exporter/molecule/default/tests/test_default.py +++ b/roles/process_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/process_exporter/molecule/latest/tests/test_latest.py b/roles/process_exporter/molecule/latest/tests/test_latest.py index 63e5d1563..0c7b0a68a 100644 --- a/roles/process_exporter/molecule/latest/tests/test_latest.py +++ b/roles/process_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/prometheus/molecule/agentmode/tests/test_agentmode.py b/roles/prometheus/molecule/agentmode/tests/test_agentmode.py index 4789e6dcc..288aed601 100644 --- a/roles/prometheus/molecule/agentmode/tests/test_agentmode.py +++ b/roles/prometheus/molecule/agentmode/tests/test_agentmode.py @@ -1,13 +1,11 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os import yaml -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.fixture() diff --git a/roles/prometheus/molecule/alternative/tests/test_alternative.py b/roles/prometheus/molecule/alternative/tests/test_alternative.py index 8635a866b..94c9e1c17 100644 --- a/roles/prometheus/molecule/alternative/tests/test_alternative.py +++ b/roles/prometheus/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("dirs", [ diff --git a/roles/prometheus/molecule/default/tests/test_default.py b/roles/prometheus/molecule/default/tests/test_default.py index da6305b69..518bcfd8a 100644 --- a/roles/prometheus/molecule/default/tests/test_default.py +++ b/roles/prometheus/molecule/default/tests/test_default.py @@ -1,13 +1,11 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os import yaml -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.fixture() diff --git a/roles/prometheus/molecule/latest/tests/test_alternative.py b/roles/prometheus/molecule/latest/tests/test_alternative.py index 04e3fdbc9..f3baca8ff 100644 --- a/roles/prometheus/molecule/latest/tests/test_alternative.py +++ b/roles/prometheus/molecule/latest/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/pushgateway/molecule/alternative/tests/test_alternative.py b/roles/pushgateway/molecule/alternative/tests/test_alternative.py index baa7e5c27..a77c95c64 100644 --- a/roles/pushgateway/molecule/alternative/tests/test_alternative.py +++ b/roles/pushgateway/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/pushgateway/molecule/default/tests/test_default.py b/roles/pushgateway/molecule/default/tests/test_default.py index b7c6ed45d..5fe09a4ef 100644 --- a/roles/pushgateway/molecule/default/tests/test_default.py +++ b/roles/pushgateway/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/pushgateway/molecule/latest/tests/test_alternative.py b/roles/pushgateway/molecule/latest/tests/test_alternative.py index 89ccc8363..117c4ae4b 100644 --- a/roles/pushgateway/molecule/latest/tests/test_alternative.py +++ b/roles/pushgateway/molecule/latest/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/redis_exporter/molecule/alternative/tests/test_alternative.py b/roles/redis_exporter/molecule/alternative/tests/test_alternative.py index 4a377bb8a..edc5e5959 100644 --- a/roles/redis_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/redis_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/redis_exporter/molecule/default/tests/test_default.py b/roles/redis_exporter/molecule/default/tests/test_default.py index 146e77e58..d0b80ec15 100644 --- a/roles/redis_exporter/molecule/default/tests/test_default.py +++ b/roles/redis_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/redis_exporter/molecule/latest/tests/test_latest.py b/roles/redis_exporter/molecule/latest/tests/test_latest.py index 360663e82..661321726 100644 --- a/roles/redis_exporter/molecule/latest/tests/test_latest.py +++ b/roles/redis_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/smartctl_exporter/molecule/alternative/tests/test_alternative.py b/roles/smartctl_exporter/molecule/alternative/tests/test_alternative.py index af8ba9d6d..be2fee9f2 100644 --- a/roles/smartctl_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/smartctl_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/smartctl_exporter/molecule/default/tests/test_default.py b/roles/smartctl_exporter/molecule/default/tests/test_default.py index 72be4f064..37c7d26b7 100644 --- a/roles/smartctl_exporter/molecule/default/tests/test_default.py +++ b/roles/smartctl_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/smartctl_exporter/molecule/latest/tests/test_latest.py b/roles/smartctl_exporter/molecule/latest/tests/test_latest.py index 3062df90f..de2947cf3 100644 --- a/roles/smartctl_exporter/molecule/latest/tests/test_latest.py +++ b/roles/smartctl_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/smokeping_prober/molecule/alternative/tests/test_alternative.py b/roles/smokeping_prober/molecule/alternative/tests/test_alternative.py index 964449030..4c9ea4394 100644 --- a/roles/smokeping_prober/molecule/alternative/tests/test_alternative.py +++ b/roles/smokeping_prober/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/smokeping_prober/molecule/default/tests/test_default.py b/roles/smokeping_prober/molecule/default/tests/test_default.py index e80de3a58..a0ce3131c 100644 --- a/roles/smokeping_prober/molecule/default/tests/test_default.py +++ b/roles/smokeping_prober/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_directories(host): diff --git a/roles/smokeping_prober/molecule/latest/tests/test_latest.py b/roles/smokeping_prober/molecule/latest/tests/test_latest.py index 9da9ec860..289c47544 100644 --- a/roles/smokeping_prober/molecule/latest/tests/test_latest.py +++ b/roles/smokeping_prober/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/snmp_exporter/molecule/alternative/tests/test_alternative.py b/roles/snmp_exporter/molecule/alternative/tests/test_alternative.py index 7c32636c2..6617f522c 100644 --- a/roles/snmp_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/snmp_exporter/molecule/alternative/tests/test_alternative.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/snmp_exporter/molecule/default/tests/test_default.py b/roles/snmp_exporter/molecule/default/tests/test_default.py index 6715e5b08..6d292e3d2 100644 --- a/roles/snmp_exporter/molecule/default/tests/test_default.py +++ b/roles/snmp_exporter/molecule/default/tests/test_default.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/snmp_exporter/molecule/latest/tests/test_latest.py b/roles/snmp_exporter/molecule/latest/tests/test_latest.py index 07d2d4ae3..adf3ad06b 100644 --- a/roles/snmp_exporter/molecule/latest/tests/test_latest.py +++ b/roles/snmp_exporter/molecule/latest/tests/test_latest.py @@ -1,12 +1,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts import pytest -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ diff --git a/roles/systemd_exporter/molecule/alternative/tests/test_alternative.py b/roles/systemd_exporter/molecule/alternative/tests/test_alternative.py index c47ea2701..10b052d3b 100644 --- a/roles/systemd_exporter/molecule/alternative/tests/test_alternative.py +++ b/roles/systemd_exporter/molecule/alternative/tests/test_alternative.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_service(host): diff --git a/roles/systemd_exporter/molecule/default/tests/test_default.py b/roles/systemd_exporter/molecule/default/tests/test_default.py index 392114ad5..75c9cb9e7 100644 --- a/roles/systemd_exporter/molecule/default/tests/test_default.py +++ b/roles/systemd_exporter/molecule/default/tests/test_default.py @@ -1,11 +1,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() def test_files(host): diff --git a/roles/systemd_exporter/molecule/latest/tests/test_latest.py b/roles/systemd_exporter/molecule/latest/tests/test_latest.py index 1f553ce87..0aa59e1cc 100644 --- a/roles/systemd_exporter/molecule/latest/tests/test_latest.py +++ b/roles/systemd_exporter/molecule/latest/tests/test_latest.py @@ -2,11 +2,9 @@ __metaclass__ = type import pytest -import os -import testinfra.utils.ansible_runner +from testinfra_helpers import get_target_hosts -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') +testinfra_hosts = get_target_hosts() @pytest.mark.parametrize("files", [ From 4e98e1f5975a686d6860f534f64e92f4be9e8918 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 27 Sep 2024 13:32:19 +0000 Subject: [PATCH 10/13] fix: make sure old versions of pytest find helper Signed-off-by: gardar --- .config/molecule/config.yml | 2 ++ .testinfra/testinfra_helpers.py | 3 +++ roles/prometheus/molecule/default/tests/test_default.py | 1 + roles/snmp_exporter/tasks/configure.yml | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 5bb016d9b..8b9c8566e 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -63,6 +63,8 @@ verifier: name: testinfra additional_files_or_dirs: - "../../../../../.testinfra/testinfra_helpers.py" + env: + PYTHONPATH: "${MOLECULE_PROJECT_DIRECTORY}/../../.testinfra:${PYTHONPATH}" provisioner: playbooks: converge: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/converge.yml" diff --git a/.testinfra/testinfra_helpers.py b/.testinfra/testinfra_helpers.py index 962f465e3..ba93ef336 100644 --- a/.testinfra/testinfra_helpers.py +++ b/.testinfra/testinfra_helpers.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import testinfra diff --git a/roles/prometheus/molecule/default/tests/test_default.py b/roles/prometheus/molecule/default/tests/test_default.py index 518bcfd8a..f5a392c46 100644 --- a/roles/prometheus/molecule/default/tests/test_default.py +++ b/roles/prometheus/molecule/default/tests/test_default.py @@ -3,6 +3,7 @@ import yaml from testinfra_helpers import get_target_hosts +import os import pytest testinfra_hosts = get_target_hosts() diff --git a/roles/snmp_exporter/tasks/configure.yml b/roles/snmp_exporter/tasks/configure.yml index 7db0c4d44..bf52bd5e8 100644 --- a/roles/snmp_exporter/tasks/configure.yml +++ b/roles/snmp_exporter/tasks/configure.yml @@ -13,7 +13,6 @@ ansible.builtin.get_url: url: "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{ snmp_exporter_version }}/snmp.yml" dest: /etc/snmp_exporter/snmp.yml - validate_certs: false owner: root group: root mode: 0644 From c8b2516c7f987f0bbbe88989d4fd7d35e2db4608 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 27 Sep 2024 16:38:46 +0000 Subject: [PATCH 11/13] refactor: streamline molecule alternative scenario further Signed-off-by: gardar --- .config/molecule/alternative/prepare.yml | 6 ++++-- roles/cadvisor/molecule/alternative/molecule.yml | 3 --- roles/fail2ban_exporter/molecule/alternative/molecule.yml | 4 ---- roles/nginx_exporter/molecule/alternative/molecule.yml | 4 ---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.config/molecule/alternative/prepare.yml b/.config/molecule/alternative/prepare.yml index 1eeadc414..217187288 100644 --- a/.config/molecule/alternative/prepare.yml +++ b/.config/molecule/alternative/prepare.yml @@ -5,8 +5,8 @@ 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') }}" + __binary_url: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_url', default='') }}" + __binary_local_dir: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_local_dir', default='') }}" __tls_server_config: "{{ lookup('ansible.builtin.vars', __role_name ~ '_tls_server_config', default={}) }}" tasks: - name: "Create local binary directory" @@ -14,6 +14,7 @@ path: "{{ __binary_local_dir }}" state: directory mode: 0755 + when: (__binary_local_dir) - name: "Fetch binary" become: false @@ -27,6 +28,7 @@ creates: "{{ __binary_local_dir }}/{{ __binary_name }}" check_mode: false register: __download_binary + when: (__binary_url) - name: Generate self signed certificates when: "'cert_file' in __tls_server_config" diff --git a/roles/cadvisor/molecule/alternative/molecule.yml b/roles/cadvisor/molecule/alternative/molecule.yml index 50e63c385..6f187635d 100644 --- a/roles/cadvisor/molecule/alternative/molecule.yml +++ b/roles/cadvisor/molecule/alternative/molecule.yml @@ -5,10 +5,7 @@ provisioner: 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 cadvisor_version: 0.47.0 cadvisor_enable_metrics: - tcp diff --git a/roles/fail2ban_exporter/molecule/alternative/molecule.yml b/roles/fail2ban_exporter/molecule/alternative/molecule.yml index 182b6776f..53118f966 100644 --- a/roles/fail2ban_exporter/molecule/alternative/molecule.yml +++ b/roles/fail2ban_exporter/molecule/alternative/molecule.yml @@ -5,9 +5,5 @@ provisioner: inventory: group_vars: all: - fail2ban_exporter_binary_local_dir: "/tmp/fail2ban_exporter-linux-amd64_local" fail2ban_exporter_web_listen_address: "127.0.1.1:9191" - go_arch: amd64 fail2ban_exporter_version: 0.10.1 - fail2ban_exporter_binary_url: "https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/releases/v{{ fail2ban_exporter_version }}/downloads/\ - fail2ban_exporter_{{ fail2ban_exporter_version }}_linux_{{ go_arch }}.tar.gz" diff --git a/roles/nginx_exporter/molecule/alternative/molecule.yml b/roles/nginx_exporter/molecule/alternative/molecule.yml index 8ae883942..b182843ea 100644 --- a/roles/nginx_exporter/molecule/alternative/molecule.yml +++ b/roles/nginx_exporter/molecule/alternative/molecule.yml @@ -5,7 +5,6 @@ provisioner: inventory: group_vars: all: - nginx_exporter_binary_local_dir: "/tmp/nginx_exporter-linux-amd64_local" nginx_exporter_web_listen_address: "127.0.0.1:9113" nginx_exporter_tls_server_config: cert_file: /etc/nginx_exporter/tls.cert @@ -14,7 +13,4 @@ provisioner: http2: true nginx_exporter_basic_auth_users: randomuser: examplepassword - go_arch: amd64 nginx_exporter_version: 1.1.0 - nginx_exporter_binary_url: "https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v{{ nginx_exporter_version }}/\ - nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_{{ go_arch }}.tar.gz" From 050c9d3347bffb1acf9d94c388c3a3837633d5b5 Mon Sep 17 00:00:00 2001 From: gardar Date: Sat, 28 Sep 2024 02:57:10 +0000 Subject: [PATCH 12/13] fix: remove unneeded download step that can cause ratelimit Signed-off-by: gardar --- roles/snmp_exporter/tasks/configure.yml | 30 +++++++++++-------------- roles/snmp_exporter/tasks/install.yml | 8 ------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/roles/snmp_exporter/tasks/configure.yml b/roles/snmp_exporter/tasks/configure.yml index bf52bd5e8..d6031d8a5 100644 --- a/roles/snmp_exporter/tasks/configure.yml +++ b/roles/snmp_exporter/tasks/configure.yml @@ -1,4 +1,12 @@ --- +- name: Create configuration directory + ansible.builtin.file: + path: "/etc/snmp_exporter" + state: directory + owner: root + group: root + mode: 0755 + - name: Copy the SNMP Exporter systemd service file ansible.builtin.template: src: snmp_exporter.service.j2 @@ -9,24 +17,9 @@ notify: - restart snmp_exporter -- name: Download snmp configuration file from github repository - ansible.builtin.get_url: - url: "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{ snmp_exporter_version }}/snmp.yml" - dest: /etc/snmp_exporter/snmp.yml - owner: root - group: root - mode: 0644 - register: _download_config - until: _download_config is success - retries: 5 - delay: 2 - notify: - - reload snmp_exporter - when: not (snmp_exporter_config_file) - - name: Copy configuration file ansible.builtin.template: - src: "{{ snmp_exporter_config_file }}" + src: "{{ snmp_exporter_config_file | default(__snmp_exporter_config_file, true) }}" dest: /etc/snmp_exporter/snmp.yml owner: root group: root @@ -34,4 +27,7 @@ no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}" notify: - reload snmp_exporter - when: (snmp_exporter_config_file) + vars: + __snmp_exporter_config_file: "{{ (snmp_exporter_binary_local_dir) | + ternary(snmp_exporter_binary_local_dir ~ '/snmp.yml', + snmp_exporter_archive_path ~ '/snmp_exporter-' ~ snmp_exporter_version ~ '.linux-' ~ go_arch ~ '/snmp.yml') }}" diff --git a/roles/snmp_exporter/tasks/install.yml b/roles/snmp_exporter/tasks/install.yml index dce9d9bc1..bcfb47dcf 100644 --- a/roles/snmp_exporter/tasks/install.yml +++ b/roles/snmp_exporter/tasks/install.yml @@ -49,11 +49,3 @@ - snmp_exporter_binary_local_dir | length > 0 - not snmp_exporter_skip_install notify: restart snmp_exporter - -- name: Create configuration directory - ansible.builtin.file: - path: "/etc/snmp_exporter" - state: directory - owner: root - group: root - mode: 0755 From 1c809bc7fc6373d4e15c9f5bc1f5def9eb4defec Mon Sep 17 00:00:00 2001 From: gardar Date: Sat, 28 Sep 2024 03:01:55 +0000 Subject: [PATCH 13/13] fix: cleanup unused playbooks now that prepare stages have been merged into one Signed-off-by: gardar --- .../molecule/alternative/prepare.yml | 33 -------- .../molecule/alternative/prepare.yml | 80 ------------------- .../cadvisor/molecule/alternative/prepare.yml | 24 ------ .../molecule/alternative/prepare.yml | 79 ------------------ .../molecule/alternative/prepare.yml | 31 ------- .../molecule/alternative/prepare.yml | 78 ------------------ .../molecule/alternative/prepare.yml | 78 ------------------ .../molecule/alternative/prepare.yml | 76 ------------------ .../molecule/alternative/prepare.yml | 80 ------------------- .../molecule/alternative/prepare.yml | 74 ----------------- .../molecule/alternative/prepare.yml | 78 ------------------ .../molecule/alternative/prepare.yml | 80 ------------------- .../molecule/alternative/prepare.yml | 77 ------------------ .../molecule/alternative/prepare.yml | 33 -------- .../molecule/alternative/prepare.yml | 76 ------------------ .../molecule/alternative/prepare.yml | 78 ------------------ .../molecule/alternative/prepare.yml | 78 ------------------ .../molecule/alternative/prepare.yml | 80 ------------------- .../molecule/alternative/prepare.yml | 80 ------------------- 19 files changed, 1293 deletions(-) delete mode 100644 roles/alertmanager/molecule/alternative/prepare.yml delete mode 100644 roles/bind_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/cadvisor/molecule/alternative/prepare.yml delete mode 100644 roles/chrony_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/fail2ban_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/ipmi_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/memcached_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/mongodb_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/mysqld_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/nginx_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/node_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/postgres_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/process_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/prometheus/molecule/alternative/prepare.yml delete mode 100644 roles/pushgateway/molecule/alternative/prepare.yml delete mode 100644 roles/redis_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/smartctl_exporter/molecule/alternative/prepare.yml delete mode 100644 roles/smokeping_prober/molecule/alternative/prepare.yml delete mode 100644 roles/systemd_exporter/molecule/alternative/prepare.yml diff --git a/roles/alertmanager/molecule/alternative/prepare.yml b/roles/alertmanager/molecule/alternative/prepare.yml deleted file mode 100644 index b1e79589b..000000000 --- a/roles/alertmanager/molecule/alternative/prepare.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Run localhost preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download alertmanager binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version\ - \ }}/alertmanager-{{ alertmanager_version }}.linux-amd64.tar.gz" - dest: "/tmp/alertmanager-{{ alertmanager_version }}.linux-amd64.tar.gz" - mode: 0644 - register: _download_archive - until: _download_archive is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack alertmanager binaries - become: false - ansible.builtin.unarchive: - src: "/tmp/alertmanager-{{ alertmanager_version }}.linux-amd64.tar.gz" - dest: "/tmp" - creates: "/tmp/alertmanager-{{ alertmanager_version }}.linux-amd64/alertmanager" - check_mode: false - - - name: Link to alertmanager binaries directory - become: false - ansible.builtin.file: - src: "/tmp/alertmanager-{{ alertmanager_version }}.linux-amd64" - dest: "/tmp/alertmanager-linux-amd64" - state: link - check_mode: false diff --git a/roles/bind_exporter/molecule/alternative/prepare.yml b/roles/bind_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index a6a857935..000000000 --- a/roles/bind_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download bind_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus-community/bind_exporter/releases/download/v{{\ - \ bind_exporter_version }}/bind_exporter-{{ bind_exporter_version\ - \ }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/bind_exporter-{{ bind_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack bind_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/bind_exporter-{{ bind_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/bind_exporter-{{ bind_exporter_version }}.linux-{{ go_arch\ - \ }}/bind_exporter" - check_mode: false - - - name: Link to bind_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/bind_exporter-{{ bind_exporter_version }}.linux-amd64" - dest: "/tmp/bind_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create bind_exporter cert dir - ansible.builtin.file: - path: "{{ bind_exporter_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: "{{ bind_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ bind_exporter_tls_server_config.key_file }}" diff --git a/roles/cadvisor/molecule/alternative/prepare.yml b/roles/cadvisor/molecule/alternative/prepare.yml deleted file mode 100644 index bf0415587..000000000 --- a/roles/cadvisor/molecule/alternative/prepare.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download cadvisor binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/google/cadvisor/releases/download/v{{ cadvisor_version }}/cadvisor-v{{ cadvisor_version }}-linux-{{ go_arch }}" - dest: "/tmp/cadvisor-v{{ cadvisor_version }}-linux-{{ go_arch }}" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Link to cadvisor binaries directory - become: false - ansible.builtin.file: - src: "/tmp/cadvisor-v{{ cadvisor_version }}-linux-{{ go_arch }}" - dest: "/tmp/cadvisor" - state: link - check_mode: false diff --git a/roles/chrony_exporter/molecule/alternative/prepare.yml b/roles/chrony_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 50740d825..000000000 --- a/roles/chrony_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download chrony_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/superq/chrony_exporter/releases/download/v{{ chrony_exporter_version\ - \ }}/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack chrony_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-{{ go_arch\ - \ }}/chrony_exporter" - check_mode: false - - - name: Link to chrony_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/chrony_exporter-{{ chrony_exporter_version }}.linux-amd64" - dest: "/tmp/chrony_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create chrony_exporter cert dir - ansible.builtin.file: - path: "{{ chrony_exporter_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: "{{ chrony_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ chrony_exporter_tls_server_config.key_file }}" diff --git a/roles/fail2ban_exporter/molecule/alternative/prepare.yml b/roles/fail2ban_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index e4e363046..000000000 --- a/roles/fail2ban_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download fail2ban_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/releases/v{{ fail2ban_exporter_version }}/downloads/\ - fail2ban_exporter_{{ fail2ban_exporter_version }}_linux_{{ go_arch }}.tar.gz" - dest: "/tmp/fail2ban_exporter_{{ fail2ban_exporter_version }}_linux_{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Create local directory for binary - ansible.builtin.file: - path: "{{ fail2ban_exporter_binary_local_dir }}" - state: directory - mode: '0755' - - - name: Unpack fail2ban_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/fail2ban_exporter_{{ fail2ban_exporter_version }}_linux_{{ go_arch }}.tar.gz" - dest: "{{ fail2ban_exporter_binary_local_dir }}" - creates: "{{ fail2ban_exporter_binary_local_dir }}/fail2ban_exporter" - check_mode: false diff --git a/roles/ipmi_exporter/molecule/alternative/prepare.yml b/roles/ipmi_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index ce3e49180..000000000 --- a/roles/ipmi_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download ipmi_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus-community/ipmi_exporter/releases/download/v{{\ - \ ipmi_exporter_version }}/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack ipmi_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/ipmi_exporter-{{ ipmi_exporter_version }}.linux-{{ go_arch\ - \ }}/ipmi_exporter" - check_mode: false - - - name: Link to ipmi_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/ipmi_exporter-{{ ipmi_exporter_version }}.linux-amd64" - dest: "/tmp/ipmi_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create ipmi_exporter cert dir - ansible.builtin.file: - path: "{{ ipmi_exporter_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: "{{ ipmi_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ ipmi_exporter_tls_server_config.key_file }}" diff --git a/roles/memcached_exporter/molecule/alternative/prepare.yml b/roles/memcached_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 4a4d99ee2..000000000 --- a/roles/memcached_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download memcached_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/memcached_exporter/releases/download/v{{\ - \ memcached_exporter_version }}/memcached_exporter-{{ memcached_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/memcached_exporter-{{ memcached_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack memcached_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/memcached_exporter-{{ memcached_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/memcached_exporter-{{ memcached_exporter_version }}.linux-{{ go_arch\ - \ }}/memcached_exporter" - check_mode: false - - - name: Link to memcached_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/memcached_exporter-{{ memcached_exporter_version }}.linux-amd64" - dest: "/tmp/memcached_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create memcached_exporter cert dir - ansible.builtin.file: - path: "{{ memcached_exporter_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: "{{ memcached_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ memcached_exporter_tls_server_config.key_file }}" diff --git a/roles/mongodb_exporter/molecule/alternative/prepare.yml b/roles/mongodb_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 5f0c0b5f1..000000000 --- a/roles/mongodb_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download mongodb_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/percona/mongodb_exporter/releases/download/v{{ mongodb_exporter_version }}/\ - mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack mongodb_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}/mongodb_exporter" - check_mode: false - - - name: Link to mongodb_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/mongodb_exporter-{{ mongodb_exporter_version }}.linux-{{ go_arch }}" - dest: "{{ mongodb_exporter_binary_local_dir }}" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create mongodb_exporter cert dir - ansible.builtin.file: - path: "{{ mongodb_exporter_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: "{{ mongodb_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ mongodb_exporter_tls_server_config.key_file }}" diff --git a/roles/mysqld_exporter/molecule/alternative/prepare.yml b/roles/mysqld_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 5de30467b..000000000 --- a/roles/mysqld_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download mysqld_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/mysqld_exporter/releases/download/v{{\ - \ mysqld_exporter_version }}/mysqld_exporter-{{ mysqld_exporter_version\ - \ }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack mysqld_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-{{ go_arch\ - \ }}/mysqld_exporter" - check_mode: false - - - name: Link to mysqld_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-amd64" - dest: "/tmp/mysqld_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create mysqld_exporter cert dir - ansible.builtin.file: - path: "{{ mysqld_exporter_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: "{{ mysqld_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ mysqld_exporter_tls_server_config.key_file }}" diff --git a/roles/nginx_exporter/molecule/alternative/prepare.yml b/roles/nginx_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 95353ae73..000000000 --- a/roles/nginx_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download nginx_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v{{ nginx_exporter_version }}/\ - nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_{{ go_arch }}.tar.gz" - dest: "/tmp/nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Create local directory for binary - ansible.builtin.file: - path: "{{ nginx_exporter_binary_local_dir }}" - state: directory - mode: '0755' - - - name: Unpack nginx_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/nginx-prometheus-exporter_{{ nginx_exporter_version }}_linux_{{ go_arch }}.tar.gz" - dest: "{{ nginx_exporter_binary_local_dir }}" - creates: "{{ nginx_exporter_binary_local_dir }}/nginx-prometheus-exporter" - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create nginx_exporter cert dir - ansible.builtin.file: - path: "{{ nginx_exporter_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: "{{ nginx_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ nginx_exporter_tls_server_config.key_file }}" diff --git a/roles/node_exporter/molecule/alternative/prepare.yml b/roles/node_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index f99a2ec6c..000000000 --- a/roles/node_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download node_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/node_exporter/releases/download/v{{\ - \ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack node_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch\ - \ }}/node_exporter" - check_mode: false - - - name: Link to node_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-amd64" - dest: "/tmp/node_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create node_exporter cert dir - ansible.builtin.file: - path: "{{ node_exporter_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: "{{ node_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ node_exporter_tls_server_config.key_file }}" diff --git a/roles/postgres_exporter/molecule/alternative/prepare.yml b/roles/postgres_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index db3e281d6..000000000 --- a/roles/postgres_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download postgres_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus-community/postgres_exporter/releases/download/v{{\ - \ postgres_exporter_version }}/postgres_exporter-{{ postgres_exporter_version\ - \ }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/postgres_exporter-{{ postgres_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack postgres_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/postgres_exporter-{{ postgres_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/postgres_exporter-{{ postgres_exporter_version }}.linux-{{ go_arch\ - \ }}/postgres_exporter" - check_mode: false - - - name: Link to postgres_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/postgres_exporter-{{ postgres_exporter_version }}.linux-amd64" - dest: "/tmp/postgres_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create postgres_exporter cert dir - ansible.builtin.file: - path: "{{ postgres_exporter_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: "{{ postgres_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ postgres_exporter_tls_server_config.key_file }}" diff --git a/roles/process_exporter/molecule/alternative/prepare.yml b/roles/process_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index 92769f434..000000000 --- a/roles/process_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download process_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/ncabatoff/process-exporter/releases/download/v{{\ - \ process_exporter_version }}/process-exporter-{{ process_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/process_exporter-{{ process_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack process_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/process_exporter-{{ process_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/process-exporter-{{ process_exporter_version }}.linux-{{ go_arch }}/process-exporter" - check_mode: false - - - name: Link to process_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/process-exporter-{{ process_exporter_version }}.linux-amd64" - dest: "/tmp/process_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create process_exporter cert dir - ansible.builtin.file: - path: "{{ process_exporter_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: "{{ process_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ process_exporter_tls_server_config.key_file }}" diff --git a/roles/prometheus/molecule/alternative/prepare.yml b/roles/prometheus/molecule/alternative/prepare.yml deleted file mode 100644 index b4be5757f..000000000 --- a/roles/prometheus/molecule/alternative/prepare.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download prometheus binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version\ - \ }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz" - dest: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz" - mode: 0644 - register: _download_archive - until: _download_archive is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack prometheus binaries - become: false - ansible.builtin.unarchive: - src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz" - dest: "/tmp" - creates: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64/prometheus" - check_mode: false - - - name: Link to prometheus binaries directory - become: false - ansible.builtin.file: - src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64" - dest: "/tmp/prometheus-linux-amd64" - state: link - check_mode: false diff --git a/roles/pushgateway/molecule/alternative/prepare.yml b/roles/pushgateway/molecule/alternative/prepare.yml deleted file mode 100644 index d7b62cd00..000000000 --- a/roles/pushgateway/molecule/alternative/prepare.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -- name: Run localhost preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download pushgateway binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus/pushgateway/releases/download/v{{ pushgateway_version\ - \ }}/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack pushgateway binary - become: false - ansible.builtin.unarchive: - src: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/pushgateway-{{ pushgateway_version }}.linux-{{ go_arch }}/pushgateway" - check_mode: false - - - name: Link to pushgateway binaries directory - become: false - ansible.builtin.file: - src: "/tmp/pushgateway-{{ pushgateway_version }}.linux-amd64" - dest: "/tmp/pushgateway-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create pushgateway cert dir - ansible.builtin.file: - path: "{{ pushgateway_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: "{{ pushgateway_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ pushgateway_tls_server_config.key_file }}" diff --git a/roles/redis_exporter/molecule/alternative/prepare.yml b/roles/redis_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index aa25cde74..000000000 --- a/roles/redis_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download redis_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/oliver006/redis_exporter/releases/download/v{{\ - \ redis_exporter_version }}/redis_exporter-v{{ redis_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/redis_exporter-v{{ redis_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack redis_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/redis_exporter-v{{ redis_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/redis_exporter-v{{ redis_exporter_version }}.linux-{{ go_arch\ - \ }}/redis_exporter" - check_mode: false - - - name: Link to redis_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/redis_exporter-v{{ redis_exporter_version }}.linux-amd64" - dest: "/tmp/redis_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create redis_exporter cert dir - ansible.builtin.file: - path: "{{ redis_exporter_tls_server_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: "{{ redis_exporter_tls_server_cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ redis_exporter_tls_server_key_file }}" diff --git a/roles/smartctl_exporter/molecule/alternative/prepare.yml b/roles/smartctl_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index d4d4c1314..000000000 --- a/roles/smartctl_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download smartctl_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus-community/smartctl_exporter/releases/download/v{{\ - \ smartctl_exporter_version }}/smartctl_exporter-{{ smartctl_exporter_version }}.linux-{{\ - \ go_arch }}.tar.gz" - dest: "/tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-{{ go_arch }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack smartctl_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp" - creates: "/tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-{{ go_arch\ - \ }}/smartctl_exporter" - check_mode: false - - - name: Link to smartctl_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64" - dest: "/tmp/smartctl_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create smartctl_exporter cert dir - ansible.builtin.file: - path: "{{ smartctl_exporter_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: "{{ smartctl_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ smartctl_exporter_tls_server_config.key_file }}" diff --git a/roles/smokeping_prober/molecule/alternative/prepare.yml b/roles/smokeping_prober/molecule/alternative/prepare.yml deleted file mode 100644 index 00c970764..000000000 --- a/roles/smokeping_prober/molecule/alternative/prepare.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download smokeping_prober binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/superq/smokeping_prober/releases/download/v{{ smokeping_prober_version\ - \ }}/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack smokeping_prober binary - become: false - ansible.builtin.unarchive: - src: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-{{\ - \ go_arch }}/smokeping_prober" - check_mode: false - - - name: Link to smokeping_prober binaries directory - become: false - ansible.builtin.file: - src: "/tmp/smokeping_prober-{{ smokeping_prober_version }}.linux-amd64" - dest: "/tmp/smokeping_prober-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create smokeping_prober cert dir - ansible.builtin.file: - path: "{{ smokeping_prober_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: "{{ smokeping_prober_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ smokeping_prober_tls_server_config.key_file }}" diff --git a/roles/systemd_exporter/molecule/alternative/prepare.yml b/roles/systemd_exporter/molecule/alternative/prepare.yml deleted file mode 100644 index ddbed0ada..000000000 --- a/roles/systemd_exporter/molecule/alternative/prepare.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- name: Run local preparation - hosts: localhost - gather_facts: false - tasks: - - name: Download systemd_exporter binary to local folder - become: false - ansible.builtin.get_url: - url: "https://github.com/prometheus-community/systemd_exporter/releases/download/v{{\ - \ systemd_exporter_version }}/systemd_exporter-{{ systemd_exporter_version\ - \ }}.linux-{{ go_arch }}.tar.gz" - dest: "/tmp/systemd_exporter-{{ systemd_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - mode: 0644 - register: _download_binary - until: _download_binary is succeeded - retries: 5 - delay: 2 - check_mode: false - - - name: Unpack systemd_exporter binary - become: false - ansible.builtin.unarchive: - src: "/tmp/systemd_exporter-{{ systemd_exporter_version }}.linux-{{ go_arch\ - \ }}.tar.gz" - dest: "/tmp" - creates: "/tmp/systemd_exporter-{{ systemd_exporter_version }}.linux-{{\ - \ go_arch }}/systemd_exporter" - check_mode: false - - - name: Link to systemd_exporter binaries directory - become: false - ansible.builtin.file: - src: "/tmp/systemd_exporter-{{ systemd_exporter_version }}.linux-amd64" - dest: "/tmp/systemd_exporter-linux-amd64" - state: link - check_mode: false - - - 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: Run target preparation - hosts: all - any_errors_fatal: true - tasks: - - name: Create systemd_exporter cert dir - ansible.builtin.file: - path: "{{ systemd_exporter_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: "{{ systemd_exporter_tls_server_config.cert_file }}" - - src: "/tmp/tls.key" - dest: "{{ systemd_exporter_tls_server_config.key_file }}"