prometheus/rpi-client/tasks/main.yaml
changeset 22 adeda2afeb75
parent 21 fecc27fe5aef
child 24 c0dde2a4b276
equal deleted inserted replaced
21:fecc27fe5aef 22:adeda2afeb75
     7 - name: install prometheus rpi-exporter
     7 - name: install prometheus rpi-exporter
     8   unarchive:
     8   unarchive:
     9     src: "{{prometheus_client_rpi_src}}"
     9     src: "{{prometheus_client_rpi_src}}"
    10     remote_src: yes
    10     remote_src: yes
    11     dest: "/tmp/"
    11     dest: "/tmp/"
       
    12   notify: restart rpi_exporter
    12 
    13 
    13 - name: install systemd service for rpi-exporter
    14 - name: install systemd service for rpi-exporter
    14   become: yes
    15   become: yes
    15   copy:
    16   copy:
    16     src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
    17     src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
    17     remote_src: yes
    18     remote_src: yes
    18     dest: "/lib/systemd/system/rpi_exporter.service"
    19     dest: "/lib/systemd/system/rpi_exporter.service"
       
    20   notify: restart rpi_exporter
    19 
    21 
    20 - name: disable GPU temp scraping
    22 - name: disable GPU temp scraping
    21   become: yes
    23   become: yes
    22   lineinfile:
    24   lineinfile:
    23     path: "/lib/systemd/system/rpi_exporter.service"
    25     path: "/lib/systemd/system/rpi_exporter.service"
    24     regexp: "^ExecStart=/usr/local/bin/rpi_exporter"
    26     regexp: "^ExecStart=/usr/local/bin/rpi_exporter"
    25     line: "ExecStart=/usr/local/bin/rpi_exporter --collector.gpu=false"
    27     line: "ExecStart=/usr/local/bin/rpi_exporter --no-collector.gpu"
       
    28   when: not prometheus_client_rpi_collect_gpu_temp
       
    29   notify: restart rpi_exporter
       
    30 
    26 
    31 
    27 - name: install rpi-exporter binary
    32 - name: install rpi-exporter binary
    28   become: yes
    33   become: yes
    29   copy:
    34   copy:
    30     src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
    35     src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
    31     remote_src: yes
    36     remote_src: yes
    32     dest: "/usr/local/bin/rpi_exporter"
    37     dest: "/usr/local/bin/rpi_exporter"
    33     mode: "0755"
    38     mode: "0755"
       
    39   notify: restart rpi_exporter
    34 
    40 
    35 - name: ensure systemd service is started
    41 - name: ensure systemd service is started
    36   become: yes
    42   become: yes
    37   systemd: name="rpi_exporter.service" enabled="yes" state="started"
    43   systemd: name="rpi_exporter.service" enabled="yes" state="started"