2022-09-22 14:38:42 +00:00
|
|
|
---
|
|
|
|
- name: Copy the node_exporter systemd service file
|
2022-09-23 12:07:54 +00:00
|
|
|
ansible.builtin.template:
|
2022-09-22 14:38:42 +00:00
|
|
|
src: node_exporter.service.j2
|
|
|
|
dest: /etc/systemd/system/node_exporter.service
|
|
|
|
owner: root
|
2022-12-08 17:45:42 +00:00
|
|
|
group: root
|
2022-09-22 14:38:42 +00:00
|
|
|
mode: 0644
|
|
|
|
notify: restart node_exporter
|
|
|
|
|
2023-05-21 20:12:35 +00:00
|
|
|
- name: Create node_exporter config directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/etc/node_exporter"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u+rwX,g+rwX,o=rX
|
2022-09-22 14:38:42 +00:00
|
|
|
|
2023-05-21 20:12:35 +00:00
|
|
|
- name: Copy the node_exporter config file
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: config.yaml.j2
|
|
|
|
dest: /etc/node_exporter/config.yaml
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart node_exporter
|
2022-09-22 14:38:42 +00:00
|
|
|
|
|
|
|
- name: Create textfile collector dir
|
2022-09-23 12:07:54 +00:00
|
|
|
ansible.builtin.file:
|
2022-09-22 14:38:42 +00:00
|
|
|
path: "{{ node_exporter_textfile_dir }}"
|
|
|
|
state: directory
|
2023-03-09 17:56:31 +00:00
|
|
|
owner: "{{ node_exporter_system_user }}"
|
|
|
|
group: "{{ node_exporter_system_group }}"
|
2022-09-22 14:38:42 +00:00
|
|
|
mode: u+rwX,g+rwX,o=rX
|
|
|
|
when: node_exporter_textfile_dir | length > 0
|
|
|
|
|
|
|
|
- name: Allow node_exporter port in SELinux on RedHat OS family
|
2022-11-25 09:18:32 +00:00
|
|
|
community.general.seport:
|
2022-09-22 14:38:42 +00:00
|
|
|
ports: "{{ node_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"
|