Files
configpolicy/roles/vmagent/templates/vmagent.container.j2
Dustin C. Hatch 3e8ac36f88 r/vmagent: Rework as container deployment
Like the _blackbox-exporter_ role, the _vmagent_ role now deploys
`vmagent` as a container.  This simplifies the process considerably,
eliminating the download/transfer step.

While refactoring this role, I also changed how the trusted CA
certificates are handled.  Rather than copy files, the role now expects
a `vmagent_ca_certs` variable.  This variable is a mapping of
certificate name (file name without extension) to PEM contents.  This
allows certificates to be defined using normal host/group variables.
2025-01-26 13:08:59 -06:00

27 lines
778 B
Django/Jinja

[Unit]
Description=Victoria Metrics vmagent
After=network.target
Wants=network.target
[Container]
Image={{ vmagent_container_image_name }}:{{ vmagent_container_image_tag }}
Pull=never
Exec=-enableTCP6 -envflag.enable
Environment=loggerDisableTimestamps=true
EnvironmentFile=/etc/sysconfig/vmagent
Mount=type=bind,source=/etc/victoria-metrics,target=/etc/victoria-metrics,readonly=true
Mount=type=bind,source=/var/lib/victoria-metrics,target=/var/lib/victoria-metrics,chown=true,relabel=shared
WorkingDir=/var/lib/victoria-metrics/vmagent
ReadOnly=yes
ReadOnlyTmpfs=yes
NoNewPrivileges=yes
User=212
Group=212
Network=host
[Service]
Restart=always
RestartSec=1s
ExecReload=/usr/bin/podman kill --cidfile=%t/%N.cid -s HUP
StateDirectory=victoria-metrics victoria-metrics/vmagent