You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/node-exporter/tasks/main.yml

62 lines
1.6 KiB
YAML

---
- name: "Send mattermost messsge"
uri:
url: "{{ mattermost_hook_smardigo }}"
method: POST
body: "{{ lookup('template','mattermost-deploy-start.json.j2') }}"
body_format: json
headers:
Content-Type: "application/json"
delegate_to: 127.0.0.1
become: false
when:
- send_status_messages
- name: "Check docker networks"
include_role:
name: _docker
tasks_from: networks
- name: "Check if node-exporter/docker-compose.yml exists"
stat:
path: '{{ service_base_path }}/node-exporter/docker-compose.yml'
register: check_docker_compose_file
- name: "Stop node-exporter"
shell: docker-compose down
args:
chdir: '{{ service_base_path }}/node-exporter'
when: check_docker_compose_file.stat.exists
ignore_errors: yes
- name: "Deploy service configuration for node-exporter"
include_role:
name: _deploy
tasks_from: configs
vars:
current_config: "node-exporter"
current_base_path: "{{ service_base_path }}"
current_destination: "node-exporter"
current_owner: "{{ docker_owner }}"
current_group: "{{ docker_group }}"
current_docker: "{{ node_exporter_docker }}"
- name: "Start node-exporter"
shell: docker-compose up -d
args:
chdir: '{{ service_base_path }}/node-exporter'
- name: "Send mattermost messsge"
uri:
url: "{{ mattermost_hook_smardigo }}"
method: POST
body: "{{ lookup('template','mattermost-deploy-end.json.j2') }}"
body_format: json
headers:
Content-Type: "application/json"
delegate_to: 127.0.0.1
become: false
when:
- send_status_messages