refactor: streamline molecule alternative scenario further

Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
gardar 2024-09-27 16:38:46 +00:00
parent 4e98e1f597
commit c8b2516c7f
No known key found for this signature in database
GPG key ID: 75FAE37CBA8C13C2
4 changed files with 4 additions and 13 deletions

View file

@ -5,8 +5,8 @@
vars: vars:
__role_name: "{{ lookup('ansible.builtin.env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" __role_name: "{{ lookup('ansible.builtin.env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
__binary_name: "{{ __role_name }}" __binary_name: "{{ __role_name }}"
__binary_url: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_url') }}" __binary_url: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_url', default='') }}"
__binary_local_dir: "{{ lookup('ansible.builtin.vars', __role_name ~ '_binary_local_dir') }}" __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={}) }}" __tls_server_config: "{{ lookup('ansible.builtin.vars', __role_name ~ '_tls_server_config', default={}) }}"
tasks: tasks:
- name: "Create local binary directory" - name: "Create local binary directory"
@ -14,6 +14,7 @@
path: "{{ __binary_local_dir }}" path: "{{ __binary_local_dir }}"
state: directory state: directory
mode: 0755 mode: 0755
when: (__binary_local_dir)
- name: "Fetch binary" - name: "Fetch binary"
become: false become: false
@ -27,6 +28,7 @@
creates: "{{ __binary_local_dir }}/{{ __binary_name }}" creates: "{{ __binary_local_dir }}/{{ __binary_name }}"
check_mode: false check_mode: false
register: __download_binary register: __download_binary
when: (__binary_url)
- name: Generate self signed certificates - name: Generate self signed certificates
when: "'cert_file' in __tls_server_config" when: "'cert_file' in __tls_server_config"

View file

@ -5,10 +5,7 @@ provisioner:
inventory: inventory:
group_vars: group_vars:
all: 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" cadvisor_port: "8000"
go_arch: amd64
cadvisor_version: 0.47.0 cadvisor_version: 0.47.0
cadvisor_enable_metrics: cadvisor_enable_metrics:
- tcp - tcp

View file

@ -5,9 +5,5 @@ provisioner:
inventory: inventory:
group_vars: group_vars:
all: all:
fail2ban_exporter_binary_local_dir: "/tmp/fail2ban_exporter-linux-amd64_local"
fail2ban_exporter_web_listen_address: "127.0.1.1:9191" fail2ban_exporter_web_listen_address: "127.0.1.1:9191"
go_arch: amd64
fail2ban_exporter_version: 0.10.1 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"

View file

@ -5,7 +5,6 @@ provisioner:
inventory: inventory:
group_vars: group_vars:
all: all:
nginx_exporter_binary_local_dir: "/tmp/nginx_exporter-linux-amd64_local"
nginx_exporter_web_listen_address: "127.0.0.1:9113" nginx_exporter_web_listen_address: "127.0.0.1:9113"
nginx_exporter_tls_server_config: nginx_exporter_tls_server_config:
cert_file: /etc/nginx_exporter/tls.cert cert_file: /etc/nginx_exporter/tls.cert
@ -14,7 +13,4 @@ provisioner:
http2: true http2: true
nginx_exporter_basic_auth_users: nginx_exporter_basic_auth_users:
randomuser: examplepassword randomuser: examplepassword
go_arch: amd64
nginx_exporter_version: 1.1.0 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"