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

Commit

Permalink
tasks,vars: move selinux package dependencies into separate tasks to …
Browse files Browse the repository at this point in the history
…allow potential ootb support for more OSes (#132)
  • Loading branch information
paulfantom authored Jan 6, 2020
1 parent 1357ea4 commit 8b0e140
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 43 deletions.
10 changes: 0 additions & 10 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
- name: Install dependencies
package:
name: "{{ item }}"
state: present
register: _install_dep_packages
until: _install_dep_packages is success
retries: 5
delay: 2
with_items: "{{ node_exporter_dependencies }}"

- name: Create the node_exporter group
group:
name: "{{ node_exporter_system_group }}"
Expand Down
20 changes: 6 additions & 14 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
---
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution_file_variety | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- node_exporter_install
- node_exporter_configure
- node_exporter_run

- import_tasks: preflight.yml
tags:
- node_exporter_install
Expand All @@ -25,6 +11,12 @@
tags:
- node_exporter_install

- import_tasks: selinux.yml
become: true
when: ansible_selinux.status == "enabled"
tags:
- node_exporter_configure

- import_tasks: configure.yml
become: true
tags:
Expand Down
39 changes: 39 additions & 0 deletions tasks/selinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
- name: Install selinux python packages [RHEL]
package:
name:
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_facts.distribution_major_version | int) < 8) | ternary('libselinux-python','python3-policycoreutils') }}"
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2
when:
- (ansible_distribution | lower == "redhat") or
(ansible_distribution | lower == "centos")

- name: Install selinux python packages [Fedora]
package:
name:
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_facts.distribution_major_version | int) < 29) | ternary('libselinux-python','python3-policycoreutils') }}"
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2

when:
- ansible_distribution | lower == "fedora"

- name: Install selinux python packages [clearlinux]
package:
name: sysadmin-basic
state: present
register: _install_selinux_packages
until: _install_selinux_packages is success
retries: 5
delay: 2
when:
- ansible_distribution | lower = "clearlinux"
3 changes: 0 additions & 3 deletions vars/clearlinux.yml

This file was deleted.

2 changes: 0 additions & 2 deletions vars/debian.yml

This file was deleted.

4 changes: 0 additions & 4 deletions vars/fedora.yml

This file was deleted.

4 changes: 0 additions & 4 deletions vars/redhat-7.yml

This file was deleted.

4 changes: 0 additions & 4 deletions vars/redhat-8.yml

This file was deleted.

2 changes: 0 additions & 2 deletions vars/suse.yml

This file was deleted.

0 comments on commit 8b0e140

Please sign in to comment.