aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yml
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-10-17 20:45:38 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-10-17 20:45:38 -0400
commita83c53c2997327c9ee7ddf4856c6360ccf541a0a (patch)
tree258668929292530a5ef90b415e92d2f6ede3147d /tasks/main.yml
parent01cda8792213340fdedcd364dedb2a73564d27f2 (diff)
downloadprometheus-a83c53c2997327c9ee7ddf4856c6360ccf541a0a.tar.gz
prometheus-a83c53c2997327c9ee7ddf4856c6360ccf541a0a.tar.xz
Update prometheus, alertmanager and add a few new optionsHEADmaster
TLS Support for everything if you configure the vars properly. Blackbox exporter. Alertmanager discord for sending alerts there via webhooks. Runit services for all of them.
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