mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-23 04:13:05 +00:00
8c9a456880
Signed-off-by: gardar <gardar@users.noreply.github.com>
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
---
|
|
- name: Copy the node_exporter systemd service file
|
|
ansible.builtin.template:
|
|
src: node_exporter.service.j2
|
|
dest: /etc/systemd/system/node_exporter.service
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: restart node_exporter
|
|
|
|
- name: Configure node_exporter
|
|
when:
|
|
( node_exporter_tls_server_config | length > 0 ) or
|
|
( node_exporter_http_server_config | length > 0 ) or
|
|
( node_exporter_basic_auth_users | length > 0 )
|
|
block:
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- name: Create textfile collector dir
|
|
ansible.builtin.file:
|
|
path: "{{ node_exporter_textfile_dir }}"
|
|
state: directory
|
|
owner: "{{ _node_exporter_system_user }}"
|
|
group: "{{ _node_exporter_system_group }}"
|
|
recurse: true
|
|
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
|
|
community.general.seport:
|
|
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"
|