Skip to content

ipmi-exporter configuration task does not respect ipmi_exporter_config_dir variable #820

Description

@blixuga

When installing ipmi-exporter using the below snippet, ansible fails trying to write the config template to a file in /etc/ipmi_exporter/
This directory does not exist due to the ipmi_exporter_config_dir: /opt/ipmi_exporter/etc being defined in vars.

roles:
    - role: prometheus.prometheus.ipmi_exporter
      vars:
        ipmi_exporter_version: latest
        ipmi_exporter_binary_install_dir: /opt/ipmi_exporter/bin
        ipmi_exporter_config_dir: /opt/ipmi_exporter/etc

The problem looks to be here, where the destination is hardcoded:

- name: Copy the ipmi_exporter config file
ansible.builtin.template:
src: config.yaml.j2
dest: /etc/ipmi_exporter/config.yaml
owner: "{{ ipmi_exporter_system_user }}"
group: "{{ ipmi_exporter_system_group }}"
mode: 0640
become: true
no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}"
notify:
- restart ipmi_exporter
tags:
- ipmi_exporter
- configure
- ipmi_exporter_configure

To fix the issue I changed the line:
dest: /etc/ipmi_exporter/config.yaml
to
dest: "{{ ipmi_exporter_config_dir }}/config.yaml"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions