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.
60 lines
2.7 KiB
60 lines
2.7 KiB
4 years ago
|
---
|
||
|
|
||
|
#
|
||
|
# Tasks related to setting up matrix-prometheus-node-exporter
|
||
|
#
|
||
|
|
||
|
- name: Ensure matrix-prometheus-node-exporter image is pulled
|
||
2 years ago
|
community.docker.docker_image:
|
||
4 years ago
|
name: "{{ matrix_prometheus_node_exporter_docker_image }}"
|
||
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||
|
force_source: "{{ matrix_prometheus_node_exporter_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||
|
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_prometheus_node_exporter_docker_image_force_pull }}"
|
||
2 years ago
|
when: "matrix_prometheus_node_exporter_enabled | bool"
|
||
3 years ago
|
register: result
|
||
|
retries: "{{ matrix_container_retries_count }}"
|
||
|
delay: "{{ matrix_container_retries_delay }}"
|
||
|
until: result is not failed
|
||
4 years ago
|
|
||
|
- name: Ensure matrix-prometheus-node-exporter.service installed
|
||
2 years ago
|
ansible.builtin.template:
|
||
4 years ago
|
src: "{{ role_path }}/templates/systemd/matrix-prometheus-node-exporter.service.j2"
|
||
|
dest: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service"
|
||
|
mode: 0644
|
||
|
register: matrix_prometheus_node_exporter_systemd_service_result
|
||
2 years ago
|
when: matrix_prometheus_node_exporter_enabled | bool
|
||
4 years ago
|
|
||
|
- name: Ensure systemd reloaded after matrix-prometheus.service installation
|
||
2 years ago
|
ansible.builtin.service:
|
||
3 years ago
|
daemon_reload: true
|
||
2 years ago
|
when: "matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_systemd_service_result.changed"
|
||
4 years ago
|
|
||
|
#
|
||
|
# Tasks related to getting rid of matrix-prometheus-node-exporter (if it was previously enabled)
|
||
|
#
|
||
|
|
||
|
- name: Check existence of matrix-prometheus-node-exporter service
|
||
2 years ago
|
ansible.builtin.stat:
|
||
4 years ago
|
path: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service"
|
||
|
register: matrix_prometheus_node_exporter_service_stat
|
||
|
|
||
|
- name: Ensure matrix-prometheus-node-exporter is stopped
|
||
2 years ago
|
ansible.builtin.service:
|
||
4 years ago
|
name: matrix-prometheus-node-exporter
|
||
|
state: stopped
|
||
3 years ago
|
enabled: false
|
||
|
daemon_reload: true
|
||
4 years ago
|
register: stopping_result
|
||
2 years ago
|
when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists"
|
||
4 years ago
|
|
||
|
- name: Ensure matrix-prometheus-node-exporter.service doesn't exist
|
||
2 years ago
|
ansible.builtin.file:
|
||
4 years ago
|
path: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service"
|
||
|
state: absent
|
||
2 years ago
|
when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists"
|
||
4 years ago
|
|
||
|
- name: Ensure systemd reloaded after matrix-prometheus-node-exporter.service removal
|
||
2 years ago
|
ansible.builtin.service:
|
||
3 years ago
|
daemon_reload: true
|
||
2 years ago
|
when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists"
|