You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.3 KiB

  1. ---
  2. - name: Download postgres_exporter from GitHub
  3. get_url:
  4. dest: /tmp/prometheus_postgres_exporter.tar.gz
  5. url: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.4.7/postgres_exporter_v0.4.7_linux-amd64.tar.gz
  6. checksum: sha256:c34d61bb4deba8efae06fd3c9979b96dae3f3c757698ce3384c80fff586c667b
  7. - name: Create postgres_exporter directory
  8. file:
  9. path: /opt/prometheus_postgres_exporter
  10. state: directory
  11. owner: postgres
  12. group: postgres
  13. mode: 0755
  14. - name: Extract postgres_exporter
  15. unarchive:
  16. remote_src: true
  17. src: /tmp/prometheus_postgres_exporter.tar.gz
  18. dest: /opt/prometheus_postgres_exporter
  19. owner: postgres
  20. group: postgres
  21. extra_opts:
  22. - --strip-components=1
  23. creates: /opt/prometheus_postgres_exporter/postgres_exporter
  24. - name: Create queries.yaml file
  25. copy:
  26. src: queries.yaml
  27. dest: /opt/prometheus_postgres_exporter/queries.yaml
  28. owner: postgres
  29. group: postgres
  30. mode: 0644
  31. - name: Create postgres_exporter service file
  32. copy:
  33. src: prometheus_postgres_exporter.service
  34. dest: /etc/systemd/system/prometheus_postgres_exporter.service
  35. owner: root
  36. group: root
  37. mode: 0644
  38. - name: Start and enable postgres_exporter service
  39. service:
  40. name: prometheus_postgres_exporter
  41. state: started
  42. enabled: true