mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-21 19:33:04 +00:00
Merge pull request #395 from gardar/update-platforms
fix: remove EOL platforms for current ones
This commit is contained in:
commit
c11ee10a50
133 changed files with 534 additions and 1713 deletions
106
.config/molecule/alternative/prepare.yml
Normal file
106
.config/molecule/alternative/prepare.yml
Normal file
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
- 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', 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"
|
||||
ansible.builtin.file:
|
||||
path: "{{ __binary_local_dir }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
when: (__binary_local_dir)
|
||||
|
||||
- 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
|
||||
when: (__binary_url)
|
||||
|
||||
- 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 }}"
|
|
@ -17,38 +17,26 @@ platforms:
|
|||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /lib/systemd/systemd
|
||||
- name: centos-7
|
||||
image: dokken/centos-7
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /usr/lib/systemd/systemd
|
||||
- name: centos-stream-9
|
||||
image: dokken/centos-stream-9
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /lib/systemd/systemd
|
||||
- name: debian-10
|
||||
image: dokken/debian-10
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /lib/systemd/systemd
|
||||
- name: debian-11
|
||||
image: dokken/debian-11
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /lib/systemd/systemd
|
||||
- name: fedora-37
|
||||
image: dokken/fedora-37
|
||||
- name: fedora-39
|
||||
image: dokken/fedora-39
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
command: /lib/systemd/systemd
|
||||
- name: fedora-38
|
||||
image: dokken/fedora-38
|
||||
- name: fedora-40
|
||||
image: dokken/fedora-40
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
cgroup_parent: docker.slice
|
||||
|
@ -65,8 +53,38 @@ 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
|
||||
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"
|
||||
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"
|
||||
|
|
|
@ -1,6 +1,33 @@
|
|||
---
|
||||
- name: Filter and add hosts to ansible_compatible_hosts
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Filter out incompatible distro/ansible version combos
|
||||
ansible.builtin.add_host:
|
||||
name: "{{ item }}"
|
||||
groups: target_hosts
|
||||
loop: >-
|
||||
{{
|
||||
groups['all']
|
||||
| map('extract', hostvars)
|
||||
| rejectattr('exclude_ansible_vers', 'defined')
|
||||
| map(attribute='inventory_hostname')
|
||||
| list
|
||||
| union(
|
||||
groups['all']
|
||||
| map('extract', hostvars)
|
||||
| selectattr('exclude_ansible_vers', 'defined')
|
||||
| rejectattr('exclude_ansible_vers', 'search', ansible_version.major ~ '.' ~ ansible_version.minor)
|
||||
| map(attribute='inventory_hostname')
|
||||
| list
|
||||
)
|
||||
}}
|
||||
when: item not in groups['target_hosts']
|
||||
changed_when: false
|
||||
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: target_hosts
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- name: "Run role"
|
||||
|
|
70
.testinfra/testinfra_helpers.py
Normal file
70
.testinfra/testinfra_helpers.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
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)
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
|
@ -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", [
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "exporter"
|
||||
- "monitoring"
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
provisioner:
|
||||
playbooks:
|
||||
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
|
||||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
cadvisor_binary_local_dir: "/tmp"
|
||||
cadvisor_port: "8000"
|
||||
go_arch: amd64
|
||||
cadvisor_version: 0.47.0
|
||||
cadvisor_enable_metrics:
|
||||
- tcp
|
||||
|
|
|
@ -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
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
provisioner:
|
||||
playbooks:
|
||||
prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml"
|
||||
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
|
||||
|
|
|
@ -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
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
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
|
||||
|
@ -13,5 +13,4 @@ provisioner:
|
|||
http2: true
|
||||
nginx_exporter_basic_auth_users:
|
||||
randomuser: examplepassword
|
||||
go_arch: amd64
|
||||
nginx_exporter_version: 1.1.0
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
|
@ -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", [
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
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 os
|
||||
import pytest
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
testinfra_hosts = get_target_hosts()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 }}"
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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", [
|
||||
|
|
|
@ -9,19 +9,18 @@ galaxy_info:
|
|||
versions:
|
||||
- "focal"
|
||||
- "jammy"
|
||||
- "noble"
|
||||
- name: "Debian"
|
||||
versions:
|
||||
- "bullseye"
|
||||
- "buster"
|
||||
- name: "EL"
|
||||
versions:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- name: "Fedora"
|
||||
versions:
|
||||
- "37"
|
||||
- '38'
|
||||
- "39"
|
||||
- "40"
|
||||
galaxy_tags:
|
||||
- "monitoring"
|
||||
- "prometheus"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue