Files
tildes/ansible/roles/prometheus_postgres_exporter/tasks/main.yml
T
Deimos 4cc100ab02 Switch to Debian 10 and Ansible
This changes the site to run on Debian 10 instead of Ubuntu 16.04. It
also fully converts the previous Salt setup to use Ansible instead.

Most of this was a relatively straightforward conversion, and it should
be very close to equivalent. One notable difference is that I removed
the setup for the "monitoring" server, since I wasn't confident that the
way of setting up self-hosted Sentry and Grafana was working any more.
I'll look to re-add that at some point, but it's not urgent.
2021-06-25 00:08:58 -06:00

48 lines
1.3 KiB
YAML

---
- name: Download postgres_exporter from GitHub
get_url:
dest: /tmp/prometheus_postgres_exporter.tar.gz
url: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.4.7/postgres_exporter_v0.4.7_linux-amd64.tar.gz
checksum: sha256:c34d61bb4deba8efae06fd3c9979b96dae3f3c757698ce3384c80fff586c667b
- name: Create postgres_exporter directory
file:
path: /opt/prometheus_postgres_exporter
state: directory
owner: postgres
group: postgres
mode: 0755
- name: Extract postgres_exporter
unarchive:
remote_src: true
src: /tmp/prometheus_postgres_exporter.tar.gz
dest: /opt/prometheus_postgres_exporter
owner: postgres
group: postgres
extra_opts:
- --strip-components=1
creates: /opt/prometheus_postgres_exporter/postgres_exporter
- name: Create queries.yaml file
copy:
src: queries.yaml
dest: /opt/prometheus_postgres_exporter/queries.yaml
owner: postgres
group: postgres
mode: 0644
- name: Create postgres_exporter service file
copy:
src: prometheus_postgres_exporter.service
dest: /etc/systemd/system/prometheus_postgres_exporter.service
owner: root
group: root
mode: 0644
- name: Start and enable postgres_exporter service
service:
name: prometheus_postgres_exporter
state: started
enabled: true