ansible-collection-prometheus/roles/mongodb_exporter/tasks/main.yml
Oleg Klyuchkin 3e4ff17886
feat: Add mongodb_exporter (#293)
* feat: Add mongodb_exporter

---------

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

63 lines
1.7 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
apply:
tags:
- mongodb_exporter_install
- mongodb_exporter_configure
- mongodb_exporter_run
tags:
- mongodb_exporter_install
- mongodb_exporter_configure
- mongodb_exporter_run
- name: Install
ansible.builtin.include_tasks:
file: install.yml
apply:
become: true
tags:
- mongodb_exporter_install
when:
( not __mongodb_exporter_is_installed.stat.exists ) or
( (__mongodb_exporter_current_version_output.stderr_lines | length > 0)
and (__mongodb_exporter_current_version_output.stderr_lines[1].split(" ")[1] != 'v' + mongodb_exporter_version) ) or
( (__mongodb_exporter_current_version_output.stdout_lines | length > 0)
and (__mongodb_exporter_current_version_output.stdout_lines[1].split(" ")[1] != 'v' + mongodb_exporter_version) ) or
( mongodb_exporter_binary_local_dir | length > 0 )
tags:
- mongodb_exporter_install
- name: SELinux
ansible.builtin.include_tasks:
file: selinux.yml
apply:
become: true
tags:
- mongodb_exporter_configure
when: ansible_selinux.status == "enabled"
tags:
- mongodb_exporter_configure
- name: Configure
ansible.builtin.include_tasks:
file: configure.yml
apply:
become: true
tags:
- mongodb_exporter_configure
tags:
- mongodb_exporter_configure
- name: Ensure mongodb_exporter is enabled on boot
become: true
ansible.builtin.systemd:
daemon_reload: true
name: mongodb_exporter
enabled: true
state: started
when:
- not ansible_check_mode
tags:
- mongodb_exporter_run