ansible-edda/playbooks/roles/services/deploy/metrics/templates/systemd/pod-metrics.service

34 lines
1.4 KiB
Desktop File

[Unit]
Description=Podman pod-metrics.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
Wants=pod-metrics-prometheus.service
Before=pod-metrics-prometheus.service
OnFailure=status-mail@%n.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-metrics.pid %t/pod-metrics.pod-id
ExecStartPre=/usr/bin/podman pod create \
--infra-conmon-pidfile %t/pod-metrics.pid \
--pod-id-file %t/pod-metrics.pod-id \
--name=metrics \
--network=none \
--replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-metrics.pod-id
ExecStartPost=/usr/bin/sh -c 'podman inspect --format "{% raw %}{{ .State.Pid }}{% endraw %}" $(podman inspect --format "{% raw %}{{ .InfraContainerID }}{% endraw %}" metrics) > {{ services_containers_directory }}/pod-metrics/pidfile'
ExecStartPost=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-metrics
ExecStartPost=/usr/bin/sudo /usr/sbin/ifup veth-metrics
ExecStop=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-metrics
ExecStop=/usr/bin/podman pod stop --ignore --pod-id-file %t/pod-metrics.pod-id -t 10
ExecStopPost=/usr/bin/podman pod rm --ignore -f --pod-id-file %t/pod-metrics.pod-id
ExecStopPost=/bin/rm -f {{ services_containers_directory }}/pod-metrics/pidfile
PIDFile=%t/pod-metrics.pid
Type=forking
[Install]
WantedBy=multi-user.target default.target