Skip to content

feat(ipmi-exporter): add option to run with udev-based device access - #789

Open
guivin wants to merge 2 commits into
prometheus-community:mainfrom
guivin:feat/run-ipmi-exporter-with-capabilities
Open

feat(ipmi-exporter): add option to run with udev-based device access#789
guivin wants to merge 2 commits into
prometheus-community:mainfrom
guivin:feat/run-ipmi-exporter-with-capabilities

Conversation

@guivin

@guivin guivin commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Add an opt-in flag ipmi_exporter_run_with_capabilities that deploys a udev rule granting the service group read/write access to /dev/ipmi* devices. This allows FreeIPMI tools to access IPMI hardware without sudo, while preserving all systemd security hardening.

@github-actions github-actions Bot added enhancement New feature or request roles/ipmi_exporter labels Apr 22, 2026
@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Docs Build 📝

Thank you for contributing!✨

The docs for this PR have been published here:
https://prometheus-community.github.io/ansible/pr/789

You can compare to the docs for the main branch here:
https://prometheus-community.github.io/ansible/branch/main

The docsite for this PR is also available for download as an artifact from this run:
https://github.com/prometheus-community/ansible/actions/runs/25784989106

File changes:

Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

diff --git a/home/runner/work/ansible/ansible/docsbuild/base/ipmi_exporter_role.html b/home/runner/work/ansible/ansible/docsbuild/head/ipmi_exporter_role.html
index 4755047..d191d36 100644
--- a/home/runner/work/ansible/ansible/docsbuild/base/ipmi_exporter_role.html
+++ b/home/runner/work/ansible/ansible/docsbuild/head/ipmi_exporter_role.html
@@ -284,6 +284,27 @@ To check whether it is installed, run <code class="code docutils literal notrans
 </div></td>
 </tr>
 <tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-main--ipmi_exporter_udev_enable"></div><p class="ansible-option-title" id="ansible-collections-prometheus-prometheus-ipmi-exporter-role-parameter-main-ipmi-exporter-udev-enable"><strong>ipmi_exporter_udev_enable</strong></p>
+<a class="ansibleOptionLink" href="#parameter-main--ipmi_exporter_udev_enable" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>When true, deploy a udev rule granting the service group read/write access to /dev/ipmi* devices.</p>
+<p>This allows freeipmi tools to access IPMI hardware without sudo.</p>
+<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
+<ul class="simple">
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">false</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">true</span></code></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-main--ipmi_exporter_udev_rule_path"></div><p class="ansible-option-title" id="ansible-collections-prometheus-prometheus-ipmi-exporter-role-parameter-main-ipmi-exporter-udev-rule-path"><strong>ipmi_exporter_udev_rule_path</strong></p>
+<a class="ansibleOptionLink" href="#parameter-main--ipmi_exporter_udev_rule_path" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Path where the udev rule file is deployed when ipmi_exporter_udev_enable is true.</p>
+<p class="ansible-option-line"><strong class="ansible-option-default-bold">Default:</strong> <code class="ansible-option-default docutils literal notranslate"><span class="pre">&quot;/etc/udev/rules.d/99-ipmi-exporter.rules&quot;</span></code></p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-main--ipmi_exporter_version"></div><p class="ansible-option-title" id="ansible-collections-prometheus-prometheus-ipmi-exporter-role-parameter-main-ipmi-exporter-version"><strong>ipmi_exporter_version</strong></p>
 <a class="ansibleOptionLink" href="#parameter-main--ipmi_exporter_version" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>

@guivin
guivin force-pushed the feat/run-ipmi-exporter-with-capabilities branch from 1886ccd to 4425321 Compare April 22, 2026 05:21
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 22, 2026
@guivin
guivin marked this pull request as ready for review April 22, 2026 05:34
Comment thread roles/ipmi_exporter/defaults/main.yml Outdated
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 22, 2026
@guivin
guivin force-pushed the feat/run-ipmi-exporter-with-capabilities branch from d6e0e48 to f22dc4d Compare April 22, 2026 06:31
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Apr 22, 2026
- name: Reload udev rules
listen: "reload udev rules"
become: true
ansible.builtin.command:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would a systemd restart of systemd-udev-trigger.service be enough for this? It's preferred to avoid command since it's not idempotent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The --subsystem-match=ipmi filter was intentional here to limit the trigger to IPMI devices only. Restarting systemd-udev-trigger.service would re-trigger all devices system-wide which is broader.

Since changed_when: false is already set, the idempotency concern is addressed at the Ansible reporting level.

I agree command isn't ideal, but there's no clean module equivalent for a scoped udevadm trigger

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@SuperQ any additional feedback needed to move this forward ?

@guivin
guivin requested a review from SuperQ April 24, 2026 06:10
@guivin
guivin force-pushed the feat/run-ipmi-exporter-with-capabilities branch from f22dc4d to 6051ce1 Compare May 3, 2026 16:39
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 3, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 13, 2026
guivin added 2 commits May 13, 2026 09:30
Signed-off-by: Guillaume Vincent <23073977+guivin@users.noreply.github.com>
Signed-off-by: Guillaume Vincent <23073977+guivin@users.noreply.github.com>
@guivin
guivin force-pushed the feat/run-ipmi-exporter-with-capabilities branch from 9d71be7 to fe664ac Compare May 13, 2026 07:30
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants