Skip to content

Commit

Permalink
Define a var in defaults/main.yml cf. Seb's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pwalczysko committed Jan 18, 2024
1 parent cf87ee8 commit 8df2fe9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ omero_prometheus_tools_requirements:
default('zeroc-ice')}}"
- omero-py>=5.18.0
- "omero-prometheus-tools=={{ omero_prometheus_tools_version }}"

environment_file_path:
RedHat: "-/etc/sysconfig/prometheus-omero-exporter"
Debian: "-/etc/prometheus-omero-exporter"

systemd_prometheus_omero_exporter_env_file_path: >-
{{ environment_file_path[ansible_os_family] |
default('/etc')}}
11 changes: 0 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@
mode: 0644
notify:
- restart prometheus-omero-exporter
when: ansible_os_family == "RedHat"

- name: omero prometheus exporter | install service
become: true
template:
dest: /etc/systemd/system/prometheus-omero-exporter.service
src: systemd-prometheus-omero-exporter-service-debian.j2
mode: 0644
notify:
- restart prometheus-omero-exporter
when: ansible_os_family == "Debian"

- name: omero prometheus exporter | enable service
become: true
Expand Down
13 changes: 0 additions & 13 deletions templates/systemd-prometheus-omero-exporter-service-debian.j2

This file was deleted.

2 changes: 1 addition & 1 deletion templates/systemd-prometheus-omero-exporter-service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=prometheus-omero-exporter

[Service]
User={{ omero_prometheus_exporter_system_user }}
EnvironmentFile=-/etc/sysconfig/prometheus-omero-exporter
EnvironmentFile={{ systemd_prometheus_omero_exporter_env_file_path }}
ExecStart=/opt/prometheus-omero-tools/venv3/bin/omero-prometheus-tools.py $OPTIONS
RestartSec=10
Restart=on-failure
Expand Down

0 comments on commit 8df2fe9

Please sign in to comment.