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.
 
 

47 lines
1.8 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. --read-only \
  22. {% for arg in matrix_prometheus_node_exporter_container_extra_arguments %}
  23. {{ arg }} \
  24. {% endfor %}
  25. --net=host \
  26. --pid=host \
  27. --mount type=bind,src=/,dst=/host,ro,bind-propagation=rslave \
  28. {{ matrix_prometheus_node_exporter_docker_image }} \
  29. {% if matrix_prometheus_node_exporter_container_http_host_bind_port %}
  30. --web.listen-address={{ matrix_prometheus_node_exporter_container_http_host_bind_port }} \
  31. {% else %}
  32. --web.listen-address=localhost:9100 \
  33. {% endif %}
  34. --path.rootfs=/host
  35. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-prometheus-node-exporter 2>/dev/null'
  36. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-prometheus-node-exporter 2>/dev/null'
  37. Restart=always
  38. RestartSec=30
  39. SyslogIdentifier=matrix-prometheus-node-exporter
  40. [Install]
  41. WantedBy=multi-user.target