Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/_common/tasks/selinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
- configure
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}_configure"
- selinux
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding this tag? It seems unrelated to the subject


- name: Install selinux python packages [clearlinux]
ansible.builtin.package:
Expand All @@ -40,6 +41,7 @@
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
- configure
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}_configure"
- selinux

- name: Allow port in SELinux
community.general.seport:
Expand All @@ -56,3 +58,4 @@
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}"
- configure
- "{{ ansible_parent_role_names | first | regex_replace(ansible_collection_name ~ '.', '') }}_configure"
- selinux
9 changes: 9 additions & 0 deletions roles/ipmi_exporter/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ ipmi_exporter_modules:
- chassis
- sel

ipmi_exporter_sudo_commands:
- /usr/sbin/ipmimonitoring
- /usr/sbin/ipmi-sensors
- /usr/sbin/ipmi-dcmi
- /usr/sbin/ipmi-raw
- /usr/sbin/bmc-info
- /usr/sbin/ipmi-chassis
- /usr/sbin/ipmi-sel
Comment on lines +16 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the user ever need to overwrite this? Perhaps it would be better to place this as a internal variable under vars/main.yml


ipmi_exporter_web_listen_address: "0.0.0.0:9290"

ipmi_exporter_tls_server_config: {}
Expand Down
11 changes: 11 additions & 0 deletions roles/ipmi_exporter/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@
- ipmi_exporter
- configure
- ipmi_exporter_configure

- name: Create sudoers file to allow passwordless IPMI commands
ansible.builtin.copy:
dest: "/etc/sudoers.d/{{ ipmi_exporter_system_user }}"
content: |
{{ ipmi_exporter_system_user }} ALL=(ALL) NOPASSWD: {{ ipmi_exporter_sudo_commands | join(', ') }}
owner: root
group: root
mode: '0440'
become: true
when: ipmi_exporter_system_user is defined
Comment on lines +34 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use community.general.sudoers instead

3 changes: 0 additions & 3 deletions roles/ipmi_exporter/templates/ipmi_exporter.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ RestartSec=1
StartLimitInterval=0

ProtectHome=yes
NoNewPrivileges=yes

{% if (ansible_facts.packages.systemd | first).version is version('232', '>=') %}
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=yes
PrivateTmp=true
{% else %}
ProtectSystem=full
Expand Down