prometheus/rpi-client/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Wed, 13 May 2020 09:25:09 -0500
changeset 21 fecc27fe5aef
parent 15 6d7db9bae6c2
child 22 adeda2afeb75
permissions -rw-r--r--
Disable prometheus rpi exporter GPU query.

---

- name: add prometheus user to video group for rpi GPU stats
  become: yes
  user: name="prometheus" groups="video" append="yes"

- name: install prometheus rpi-exporter
  unarchive:
    src: "{{prometheus_client_rpi_src}}"
    remote_src: yes
    dest: "/tmp/"

- name: install systemd service for rpi-exporter
  become: yes
  copy:
    src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
    remote_src: yes
    dest: "/lib/systemd/system/rpi_exporter.service"

- name: disable GPU temp scraping
  become: yes
  lineinfile:
    path: "/lib/systemd/system/rpi_exporter.service"
    regexp: "^ExecStart=/usr/local/bin/rpi_exporter"
    line: "ExecStart=/usr/local/bin/rpi_exporter --collector.gpu=false"

- name: install rpi-exporter binary
  become: yes
  copy:
    src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
    remote_src: yes
    dest: "/usr/local/bin/rpi_exporter"
    mode: "0755"

- name: ensure systemd service is started
  become: yes
  systemd: name="rpi_exporter.service" enabled="yes" state="started"