ansible-collection-prometheus/roles/mongodb_exporter/tasks/main.yml
gardar c214571821
refactor(mongodb_exporter): delegate common tasks to _common role
Signed-off-by: gardar <gardar@users.noreply.github.com>
2024-10-15 17:06:59 +00:00

61 lines
2 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
tags:
- mongodb_exporter_install
- mongodb_exporter_configure
- mongodb_exporter_run
- name: Install
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: install.yml
vars:
_common_local_cache_path: "{{ mongodb_exporter_local_cache_path }}"
_common_binaries: "{{ _mongodb_exporter_binaries }}"
_common_binary_install_dir: "{{ mongodb_exporter_binary_install_dir }}"
_common_binary_url: "{{ mongodb_exporter_binary_url }}"
_common_checksums_url: "{{ mongodb_exporter_checksums_url }}"
_common_system_group: "{{ mongodb_exporter_system_group }}"
_common_system_user: "{{ mongodb_exporter_system_user }}"
_common_config_dir: "{{ mongodb_exporter_config_dir }}"
_common_binary_unarchive_opts: ['--strip-components=1']
tags:
- mongodb_exporter_install
- name: SELinux
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: selinux.yml
vars:
_common_selinux_port: "{{ mongodb_exporter_web_listen_address | urlsplit('port') }}"
when: ansible_selinux.status == "enabled"
tags:
- mongodb_exporter_configure
- name: Configure
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: configure.yml
vars:
_common_system_user: "{{ mongodb_exporter_system_user }}"
_common_system_group: "{{ mongodb_exporter_system_group }}"
_common_config_dir: "{{ mongodb_exporter_config_dir }}"
_common_tls_server_config: "{{ mongodb_exporter_tls_server_config }}"
_common_http_server_config: "{{ mongodb_exporter_http_server_config }}"
_common_basic_auth_users: "{{ mongodb_exporter_basic_auth_users }}"
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