summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/base/tasks/main.yml
blob: 235b7241921ac3c505e4ea2f146405436e0799dc (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
---
- 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: add user for prometheus-exporter
  user:
    name: prometheus-exporter
    system: yes
    home: /nonexistent
    create_home: no

- name: create base directory for exporter configs
  file:
    path: /etc/prometheus/exporter
    state: directory

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

- name: render nginx-vhost config template
  set_fact:
    prometheus_exporter_nginx_vhost_content: "{{ lookup('template', 'nginx-vhost.j2') }}"

- name: configure nginx vhost
  vars:
    nginx_vhost:
      name: prometheus-exporter
      content: "{{ prometheus_exporter_nginx_vhost_content }}"
  include_role:
    name: nginx/vhost