ansible-collection-prometheus/roles/postgres_exporter/tasks/main.yml
Oleg Klyuchkin 06490d7c8b
feat: Add postgres_exporter role (#291)
* feat: Add postgres_exporter role

---------

Signed-off-by: anviar <oleg.kluchkin+github@gmail.com>
2024-02-22 14:44:11 +01:00

63 lines
1.7 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
apply:
tags:
- postgres_exporter_install
- postgres_exporter_configure
- postgres_exporter_run
tags:
- postgres_exporter_install
- postgres_exporter_configure
- postgres_exporter_run
- name: Install
ansible.builtin.include_tasks:
file: install.yml
apply:
become: true
tags:
- postgres_exporter_install
when:
( not __postgres_exporter_is_installed.stat.exists ) or
( (__postgres_exporter_current_version_output.stderr_lines | length > 0)
and (__postgres_exporter_current_version_output.stderr_lines[0].split(" ")[2] != postgres_exporter_version) ) or
( (__postgres_exporter_current_version_output.stdout_lines | length > 0)
and (__postgres_exporter_current_version_output.stdout_lines[0].split(" ")[2] != postgres_exporter_version) ) or
( postgres_exporter_binary_local_dir | length > 0 )
tags:
- postgres_exporter_install
- name: SELinux
ansible.builtin.include_tasks:
file: selinux.yml
apply:
become: true
tags:
- postgres_exporter_configure
when: ansible_selinux.status == "enabled"
tags:
- postgres_exporter_configure
- name: Configure
ansible.builtin.include_tasks:
file: configure.yml
apply:
become: true
tags:
- postgres_exporter_configure
tags:
- postgres_exporter_configure
- name: Ensure PostgreSQL Exporter is enabled on boot
become: true
ansible.builtin.systemd:
daemon_reload: true
name: postgres_exporter
enabled: true
state: started
when:
- not ansible_check_mode
tags:
- postgres_exporter_run