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"
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/etcbeing defined in vars.The problem looks to be here, where the destination is hardcoded:
ansible/roles/ipmi_exporter/tasks/configure.yml
Lines 18 to 32 in f5e308c
To fix the issue I changed the line:
dest: /etc/ipmi_exporter/config.yamlto
dest: "{{ ipmi_exporter_config_dir }}/config.yaml"