Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Commit 8b0e140

Browse files
authored
tasks,vars: move selinux package dependencies into separate tasks to allow potential ootb support for more OSes (#132)
1 parent 1357ea4 commit 8b0e140

File tree

9 files changed

+45
-43
lines changed

9 files changed

+45
-43
lines changed

tasks/install.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
---
2-
- name: Install dependencies
3-
package:
4-
name: "{{ item }}"
5-
state: present
6-
register: _install_dep_packages
7-
until: _install_dep_packages is success
8-
retries: 5
9-
delay: 2
10-
with_items: "{{ node_exporter_dependencies }}"
11-
122
- name: Create the node_exporter group
133
group:
144
name: "{{ node_exporter_system_group }}"

tasks/main.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
---
2-
- name: Gather variables for each operating system
3-
include_vars: "{{ item }}"
4-
with_first_found:
5-
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
6-
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
7-
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
8-
- "{{ ansible_distribution_file_variety | lower }}.yml"
9-
- "{{ ansible_distribution | lower }}.yml"
10-
- "{{ ansible_os_family | lower }}.yml"
11-
tags:
12-
- node_exporter_install
13-
- node_exporter_configure
14-
- node_exporter_run
15-
162
- import_tasks: preflight.yml
173
tags:
184
- node_exporter_install
@@ -25,6 +11,12 @@
2511
tags:
2612
- node_exporter_install
2713

14+
- import_tasks: selinux.yml
15+
become: true
16+
when: ansible_selinux.status == "enabled"
17+
tags:
18+
- node_exporter_configure
19+
2820
- import_tasks: configure.yml
2921
become: true
3022
tags:

tasks/selinux.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
- name: Install selinux python packages [RHEL]
3+
package:
4+
name:
5+
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
6+
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-policycoreutils') }}"
7+
state: present
8+
register: _install_selinux_packages
9+
until: _install_selinux_packages is success
10+
retries: 5
11+
delay: 2
12+
when:
13+
- (ansible_distribution | lower == "redhat") or
14+
(ansible_distribution | lower == "centos")
15+
16+
- name: Install selinux python packages [Fedora]
17+
package:
18+
name:
19+
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-libselinux') }}"
20+
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-policycoreutils') }}"
21+
state: present
22+
register: _install_selinux_packages
23+
until: _install_selinux_packages is success
24+
retries: 5
25+
delay: 2
26+
27+
when:
28+
- ansible_distribution | lower == "fedora"
29+
30+
- name: Install selinux python packages [clearlinux]
31+
package:
32+
name: sysadmin-basic
33+
state: present
34+
register: _install_selinux_packages
35+
until: _install_selinux_packages is success
36+
retries: 5
37+
delay: 2
38+
when:
39+
- ansible_distribution | lower = "clearlinux"

vars/clearlinux.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

vars/debian.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

vars/fedora.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

vars/redhat-7.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

vars/redhat-8.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

vars/suse.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)