ansible-collection-prometheus/roles/mongodb_exporter/tasks/configure.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

36 lines
1,019 B
YAML

---
- name: Copy the mongodb_exporter systemd service file
ansible.builtin.template:
src: mongodb_exporter.service.j2
dest: /etc/systemd/system/mongodb_exporter.service
owner: root
group: root
mode: 0644
notify: restart mongodb_exporter
- name: Create mongodb_exporter config directory
ansible.builtin.file:
path: "/etc/mongodb_exporter"
state: directory
owner: root
group: root
mode: u+rwX,g+rwX,o=rX
- name: Copy the mongodb_exporter web config file
ansible.builtin.template:
src: web_config.yaml.j2
dest: /etc/mongodb_exporter/web_config.yaml
owner: root
group: root
mode: 0644
notify: restart mongodb_exporter
- name: Allow mongodb_exporter port in SELinux on RedHat OS family
community.general.seport:
ports: "{{ mongodb_exporter_web_listen_address.split(':')[-1] }}"
proto: tcp
setype: http_port_t
state: present
when:
- ansible_version.full is version_compare('2.4', '>=')
- ansible_selinux.status == "enabled"