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/ipmi_exporter/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ ipmi_exporter_config_dir: /etc/ipmi_exporter

# Local path to stash the archive and its extraction
ipmi_exporter_local_cache_path: "/tmp/ipmi_exporter-{{ ansible_facts['system'] | lower }}-{{ _ipmi_exporter_go_ansible_arch }}/{{ ipmi_exporter_version }}"

ipmi_exporter_run_with_sudo: true
ipmi_exporter_sudoers_name: "99-ipmi-exporter"
7 changes: 7 additions & 0 deletions roles/ipmi_exporter/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@
- ipmi_exporter
- configure
- ipmi_exporter_configure

- name: Create the sudoers file to run ipmi commands
community.general.sudoers:
name: "{{ ipmi_exporter_sudoers_name }}"
user: "{{ ipmi_exporter_system_user }}"
commands: "{{ _ipmi_exporter_sudo_commands }}"
when: ipmi_exporter_run_with_sudo
5 changes: 5 additions & 0 deletions roles/ipmi_exporter/templates/ipmi_exporter.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ RestartSec=1
StartLimitInterval=0

ProtectHome=yes

{% if not ipmi_exporter_run_with_sudo %}
NoNewPrivileges=yes
{% endif %}

{% if (ansible_facts.packages.systemd | first).version is version('232', '>=') %}
ProtectSystem=strict
ProtectControlGroups=true
{% if not ipmi_exporter_run_with_sudo %}
ProtectKernelModules=true
ProtectKernelTunables=yes
{% endif %}
PrivateTmp=true
{% else %}
ProtectSystem=full
Expand Down
8 changes: 8 additions & 0 deletions roles/ipmi_exporter/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ _ipmi_exporter_binaries: ['ipmi_exporter']
_ipmi_exporter_dependencies: "{{ (ansible_facts['pkg_mgr'] == 'apt')
| ternary((['python-apt'] if ansible_facts['python_version'] is version('3', '<') else ['python3-apt']),
[]) + ['freeipmi'] }}"
_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