prometheus/rpi-client/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 09 Jun 2020 14:39:54 -0500
changeset 38 b4e705f4cda4
parent 30 bf16f2477a11
permissions -rw-r--r--
Suppress warning.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add prometheus user to video group for rpi GPU stats
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  user: name="prometheus" groups="video" append="yes"
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
8
20975062661d Added grafana restart handler.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
     7
- name: install prometheus rpi-exporter
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  unarchive:
15
6d7db9bae6c2 Fixed some bugs with prometheus node exporter not starting.
Luke Hoersten <luke@hoersten.org>
parents: 8
diff changeset
     9
    src: "{{prometheus_client_rpi_src}}"
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    remote_src: yes
30
bf16f2477a11 Do not re-download each time.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    11
    dest: "/tmp"
bf16f2477a11 Do not re-download each time.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    12
    creates: "/tmp/{{prometheus_client_rpi_dest}}"
22
adeda2afeb75 Fixed gpu collector on rpi.
Luke Hoersten <luke@hoersten.org>
parents: 21
diff changeset
    13
  notify: restart rpi_exporter
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
24
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    15
- name: disable GPU temp scraping
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    16
  become: yes
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    17
  lineinfile:
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    18
    path: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    19
    regexp: "^ExecStart=/usr/local/bin/rpi_exporter"
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    20
    line: "ExecStart=/usr/local/bin/rpi_exporter --no-collector.gpu"
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    21
  when: not prometheus_client_rpi_collect_gpu_temp
27
8fddefdd948b More fixes
Luke Hoersten <luke@hoersten.org>
parents: 24
diff changeset
    22
  changed_when: false
24
c0dde2a4b276 rpi-export: disable gpu temp before systemd config.
Luke Hoersten <luke@hoersten.org>
parents: 22
diff changeset
    23
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
- name: install systemd service for rpi-exporter
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  become: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  copy:
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    remote_src: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    dest: "/lib/systemd/system/rpi_exporter.service"
22
adeda2afeb75 Fixed gpu collector on rpi.
Luke Hoersten <luke@hoersten.org>
parents: 21
diff changeset
    30
  notify: restart rpi_exporter
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
- name: install rpi-exporter binary
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  become: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
  copy:
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
    remote_src: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    dest: "/usr/local/bin/rpi_exporter"
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
    mode: "0755"
22
adeda2afeb75 Fixed gpu collector on rpi.
Luke Hoersten <luke@hoersten.org>
parents: 21
diff changeset
    39
  notify: restart rpi_exporter
6
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
- name: ensure systemd service is started
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  become: yes
3b1f18f6a5a4 Updated prometheus roles. WIP psql, nginx exporters.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  systemd: name="rpi_exporter.service" enabled="yes" state="started"