summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/base/tasks/main.yml
blob: 9a214f39e0cfd237fc915d42394aff811cdda945 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: check if prometheus apt component of spreadspace repo is enabled
  assert:
    msg: "please enable the 'prometheus' component of spreadspace repo using 'spreadspace_apt_repo_components'"
    that:
    - spreadspace_apt_repo_components is defined
    - "'prometheus' in spreadspace_apt_repo_components"

- name: install apt packages
  apt:
    name: prom-exporter-exporter
    state: present

- name: create configuration directories
  file:
    path: /etc/prometheus/exporter/enabled
    state: directory

- name: add user for prometheus-exporter
  user:
    name: prometheus-exporter
    system: yes
    home: /nonexistent
    create_home: no

- name: create TLS certificate and key
  import_tasks: tls.yml

- name: generate systemd service unit
  template:
    src: service.j2
    dest: /etc/systemd/system/prometheus-exporter-exporter.service
  notify: restart prometheus-exporter-exporter

- name: make sure prometheus-exporter-exporter is enabled and started
  systemd:
    name: prometheus-exporter-exporter.service
    daemon_reload: yes
    state: started
    enabled: yes