Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

44 lines
1.6 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=matrix-prometheus-node-exporter
  4. {% for service in matrix_prometheus_node_exporter_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_prometheus_node_exporter_systemd_wanted_services_list %}
  9. Wants={{ service }}
  10. {% endfor %}
  11. DefaultDependencies=no
  12. [Service]
  13. Type=simple
  14. Environment="HOME={{ matrix_systemd_unit_home_path }}"
  15. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-prometheus-node-exporter 2>/dev/null'
  16. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-prometheus-node-exporter 2>/dev/null'
  17. ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-prometheus-node-exporter \
  18. --log-driver=none \
  19. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  20. --cap-drop=ALL \
  21. {% if matrix_prometheus_node_exporter_container_http_host_bind_port %}
  22. -p {{ matrix_prometheus_node_exporter_container_http_host_bind_port }}:9100 \
  23. {% endif %}
  24. {% for arg in matrix_prometheus_node_exporter_container_extra_arguments %}
  25. {{ arg }} \
  26. {% endfor %}
  27. --net="host" \
  28. --pid="host" \
  29. -v "/:/host:ro,rslave" \
  30. {{ matrix_prometheus_node_exporter_docker_image }} \
  31. --path.rootfs=/host
  32. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-prometheus-node-exporter 2>/dev/null'
  33. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-prometheus-node-exporter 2>/dev/null'
  34. Restart=always
  35. RestartSec=30
  36. SyslogIdentifier=matrix-prometheus-node-exporter
  37. [Install]
  38. WantedBy=multi-user.target