aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'tasks/main.yml')
-rw-r--r--tasks/main.yml46
1 files changed, 44 insertions, 2 deletions
diff --git a/tasks/main.yml b/tasks/main.yml
index 19ca131..e9a017a 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -30,11 +30,12 @@
#!/bin/sh
set -e
if ! [ -e "{{prometheus_home_dir}}/{{prometheus_extract_dir}}" ] ; then
- su - '{{prometheus_user}}' -c 'tar xzf prometheus-{{prometheus_version}}.tgz'
+ su - '{{prometheus_user}}' -c 'cd "{{prometheus_home_dir}}"; tar xzf prometheus-{{prometheus_version}}.tgz'
exit 50
fi
register: res
changed_when: res is defined and res.rc == 50
+ # failed_when: res is defined and ( res.rc != 50 or res.rc != 0 )
ignore_errors: true
notify: Restart Prometheus
- name: Link prometheus directory
@@ -53,13 +54,34 @@
- prometheus.yml
- name: Write prometheus configuration file
copy:
- content: '{{prometheus_config | to_nice_yaml}}'
+ content: '{{prometheus_config | to_nice_json}}'
dest: '{{prometheus_home_dir}}/conf/prometheus.yml'
owner: '{{prometheus_user}}'
mode: '0600'
notify: Restart prometheus
tags:
- configuration
+- name: Write prometheus web configuration file
+ copy:
+ content: '{{prometheus_web_config | to_nice_json}}'
+ dest: '{{prometheus_home_dir}}/conf/web_conf.yml'
+ owner: '{{prometheus_user}}'
+ mode: '0600'
+ when: prometheus_web_config is defined
+ notify: Restart prometheus
+ tags:
+ - configuration
+- name: Write other config files
+ copy:
+ content: '{{item.content}}'
+ dest: '{{prometheus_home_dir}}/conf/{{item.filename}}'
+ owner: '{{prometheus_user}}'
+ mode: '0600'
+ loop: '{{prometheus_other_config | dict2items(key_name="filename", value_name="content")}}'
+ when: prometheus_other_config is defined
+ notify: Restart prometheus
+ tags:
+ - configuration
- name: Create Runit Directory
file:
state: directory
@@ -72,6 +94,8 @@
dest: /etc/sv/prometheus/run
owner: root
mode: '0755'
+ tags:
+ - configuration
- name: Enable Runit service
file:
state: link
@@ -86,3 +110,21 @@
tags:
- alertmanager
when: alertmanager
+- name: Include Blackbox Exporter tasks
+ include_tasks:
+ file: blackbox.yml
+ apply:
+ tags:
+ - blackbox
+ tags:
+ - blackbox
+ when: blackbox_exporter
+- name: Include Discord tasks
+ include_tasks:
+ file: discord.yml
+ apply:
+ tags:
+ - discord
+ tags:
+ - discord
+ when: alertmanager_discord