aboutsummaryrefslogtreecommitdiffstats
path: root/roles/prometheus/tasks
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2022-02-20 17:09:26 +0100
committerGravatar Johannes Christ <[email protected]>2022-02-21 20:19:14 +0100
commit9c809811dfb6b931c30985b78c8573eacbc0a6e3 (patch)
treeb30e79c398b3f48e643bd56581ecc14d8476e44c /roles/prometheus/tasks
parentSave host allocation file in the repository (diff)
Deploy Prometheus & node-exporter
To start off, we are only scraping Prometheus itself and node-exporter.
Diffstat (limited to 'roles/prometheus/tasks')
-rw-r--r--roles/prometheus/tasks/main.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml
new file mode 100644
index 0000000..08aff38
--- /dev/null
+++ b/roles/prometheus/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: install prometheus
+ package:
+ name: prometheus
+ state: present
+ tags:
+ - role::prometheus
+
+- name: configure prometheus command line options
+ lineinfile:
+ path: /etc/default/prometheus
+ regexp: ^ARGS.*
+ line: ARGS="{{ prometheus_cmdline_options }}"
+ tags:
+ - role::prometheus
+ when:
+ - prometheus_cmdline_options is defined
+ notify:
+ - restart the prometheus service
+
+- name: configure prometheus
+ copy:
+ content: |
+ # Ansible managed
+ {{ prometheus_configuration | to_nice_yaml }}
+ dest: /etc/prometheus/prometheus.yml
+ owner: prometheus
+ group: prometheus
+ mode: 0400
+ tags:
+ - role::prometheus
+ notify:
+ - reload the prometheus service