Skip to content

Commit ba12ec0

Browse files
committed
Fix an issue with blackbox exporter — array of depencencies was a string
Signed-off-by: Kuba Orlik <[email protected]>
1 parent c7a8953 commit ba12ec0

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

roles/_common/meta/argument_specs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ argument_specs:
7777
options:
7878
_common_dependencies:
7979
description: "Package dependencies to install"
80-
default: "{% if (ansible_facts['pkg_mgr'] == 'apt') %}\
81-
{{ ('python-apt' if ansible_facts['python_version'] is version('3', '<') else 'python3-apt') }}
82-
{% else %}\
83-
{% endif %}"
80+
default: >-
81+
{{ ['python-apt'] if ansible_facts['pkg_mgr'] == 'apt' and ansible_facts['python_version'] is version('3', '<')
82+
else ['python3-apt'] if ansible_facts['pkg_mgr'] == 'apt'
83+
else [] }}
8484
_common_web_listen_address:
8585
description: "Address on which to listen"
8686
default: ""

roles/_common/tasks/preflight.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
- name: Install dependencies
5656
become: true
5757
ansible.builtin.package:
58-
name: "{{ _common_dependencies }}"
58+
name: "{{ item }}"
5959
state: present
60-
when: (_common_dependencies != None)
60+
loop: "{{_common_dependencies}}"
6161
tags:
6262
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
6363
- configure

roles/_common/vars/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ _common_selinux_port: ""
1010
_common_service_name: "{{ __common_parent_role_short_name }}"
1111
_common_system_user: ""
1212
_common_system_group: ""
13-
_common_dependencies: "{% if (ansible_facts['pkg_mgr'] == 'apt') %}\
14-
{{ ('python-apt' if ansible_facts['python_version'] is version('3', '<') else 'python3-apt') }}
15-
{% else %}\
16-
{% endif %}"
13+
_common_dependencies: >-
14+
{{ ['python-apt'] if ansible_facts['pkg_mgr'] == 'apt' and ansible_facts['python_version'] is version('3', '<')
15+
else ['python3-apt'] if ansible_facts['pkg_mgr'] == 'apt'
16+
else [] }}
1717
_common_binary_unarchive_opts: ""
1818
_common_tls_server_config: {}
1919
_common_http_server_config: {}

roles/blackbox_exporter/vars/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ _blackbox_exporter_go_ansible_arch: "{{ {'i386': '386',
77
_blackbox_exporter_repo: "prometheus/blackbox_exporter"
88
_github_api_headers: "{{ {'GITHUB_TOKEN': lookup('ansible.builtin.env', 'GITHUB_TOKEN')} if (lookup('ansible.builtin.env', 'GITHUB_TOKEN')) else {} }}"
99
_blackbox_exporter_binaries: ['blackbox_exporter']
10-
_blackbox_exporter_dependencies: "{% if (ansible_facts['pkg_mgr'] == 'apt') %}\
11-
{{ (['python-apt', 'libcap2-bin'] if ansible_facts['python_version'] is version('3', '<') else ['python3-apt', 'libcap2-bin']) }}
12-
{% else %}\
13-
{% endif %}"
10+
_blackbox_exporter_dependencies: >-
11+
{{ ['python-apt', 'libcap2-bin']
12+
if ansible_facts['pkg_mgr'] == 'apt' and ansible_facts['python_version'] is version('3', '<')
13+
else ['python3-apt', 'libcap2-bin'] if ansible_facts['pkg_mgr'] == 'apt'
14+
else [] }}

0 commit comments

Comments
 (0)