cloudalchemy / ansible-node-exporter

Provision basic metrics exporter for prometheus monitoring tool
MIT License
501 stars 270 forks source link

"Allow node_exporter port in SELinux on RedHat OS family" fails on Debian9 with SELinux enabled #198

Closed sgargel closed 1 year ago

sgargel commented 3 years ago

What happened?

Seems this task is not working against a debian9 with SELinux enabled.

- name: Allow node_exporter port in SELinux on RedHat OS family
  seport:
    ports: "{{ node_exporter_web_listen_address.split(':')[-1] }}"
    proto: tcp
    setype: http_port_t
    state: present
  when:
    - ansible_version.full is version_compare('2.4', '>=')
    - ansible_selinux.status == "enabled"
TASK [cloudalchemy.node-exporter : Allow node_exporter port in SELinux on RedHat OS family] **************************************************************************************
Monday 28 December 2020  12:09:27 +0100 (0:00:01.755)       0:00:24.342 ******* 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named seobject
fatal: [debian8-server]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (policycoreutils-python) on debian8-server's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

However the seport module is not tested against debian (https://docs.ansible.com/ansible/2.9/modules/seport_module.html#notes).

I'm not sure but probably the best idea is to disable the task by adding

- not ansible_distribution | lower == "debian"

If you agree I can do a PR.

Environment

SuperQ commented 1 year ago

This role has been deprecated in favor of a the prometheus-community/ansible collection.