Skip to content

Commit

Permalink
Enable podman exporter
Browse files Browse the repository at this point in the history
This PR enables podman_exporter back and add support for TLS certificates.
  • Loading branch information
paramite committed Feb 4, 2025
1 parent ec4f092 commit 3788ec1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions roles/edpm_telemetry/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ edpm_telemetry_healthcheck: true
edpm_telemetry_enabled_exporters:
- ceilometer_agent_compute
- node_exporter
- podman_exporter
13 changes: 8 additions & 5 deletions roles/edpm_telemetry/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@
when:
- tls_crt_stat.stat.exists and tls_key_stat.stat.exists
block:
- name: Create config file for node_exporter
ansible.builtin.template:
dest: "{{ edpm_telemetry_config_dest }}/node_exporter.yaml"
mode: "0644"
src: node_exporter.yaml.j2
- name: Create config file for exporters
ansible.builtin.include_tasks:
file: exporter_tls.yml
loop:
- node_exporter
- podman_exporter
loop_control:
loop_var: exporter

- name: Change the owner of the crt
become: true
Expand Down
7 changes: 7 additions & 0 deletions roles/edpm_telemetry/tasks/exporter_tls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Create config file for exporter
ansible.builtin.template:
dest: "{{ edpm_telemetry_config_dest }}/{{ exporter }}.yaml"
mode: "0644"
src: "{{ exporter }}.yaml.j2"
9 changes: 9 additions & 0 deletions roles/edpm_telemetry/templates/podman_exporter.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"privileged": true,
"ports": ["9882:9882"],
"net": "host",
{% if tls_cert_exists|bool %}
"command": [
"--web.config.file=/etc/podman_exporter/podman_exporter.yaml"
],
{% endif %}
"environment": {
"OS_ENDPOINT_TYPE": "internal",
"CONTAINER_HOST": "unix:///run/podman/podman.sock"
Expand All @@ -17,6 +22,10 @@
},
{% endif %}
"volumes": [
{% if tls_cert_exists|bool %}
"{{ edpm_telemetry_config_dest }}/podman_exporter.yaml:/etc/podman_exporter/podman_exporter.yaml:z",
"{{ edpm_telemetry_certs }}:/etc/podman_exporter/tls:z",
{% endif %}
"/run/podman/podman.sock:/run/podman/podman.sock:rw,z"
]
}
3 changes: 3 additions & 0 deletions roles/edpm_telemetry/templates/podman_exporter.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tls_server_config:
cert_file: /etc/podman_exporter/tls/tls.crt
key_file: /etc/podman_exporter/tls/tls.key

0 comments on commit 3788ec1

Please sign in to comment.