2022-09-22 14:38:42 +00:00
|
|
|
---
|
2022-11-25 09:18:32 +00:00
|
|
|
- name: Preflight
|
|
|
|
ansible.builtin.include_tasks: preflight.yml
|
2022-09-22 14:38:42 +00:00
|
|
|
tags:
|
|
|
|
- node_exporter_install
|
|
|
|
- node_exporter_configure
|
|
|
|
- node_exporter_run
|
|
|
|
|
2022-11-25 09:18:32 +00:00
|
|
|
- name: Install
|
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: install.yml
|
|
|
|
apply:
|
|
|
|
become: true
|
2022-09-22 14:38:42 +00:00
|
|
|
when:
|
|
|
|
( not __node_exporter_is_installed.stat.exists ) or
|
2022-11-25 13:53:37 +00:00
|
|
|
( (__node_exporter_current_version_output.stderr_lines | length > 0)
|
|
|
|
and (__node_exporter_current_version_output.stderr_lines[0].split(" ")[2] != node_exporter_version) ) or
|
|
|
|
( (__node_exporter_current_version_output.stdout_lines | length > 0)
|
|
|
|
and (__node_exporter_current_version_output.stdout_lines[0].split(" ")[2] != node_exporter_version) ) or
|
2022-09-22 14:38:42 +00:00
|
|
|
( node_exporter_binary_local_dir | length > 0 )
|
|
|
|
tags:
|
|
|
|
- node_exporter_install
|
|
|
|
|
2022-11-25 09:18:32 +00:00
|
|
|
- name: SELinux
|
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: selinux.yml
|
|
|
|
apply:
|
|
|
|
become: true
|
2022-09-22 14:38:42 +00:00
|
|
|
when: ansible_selinux.status == "enabled"
|
|
|
|
tags:
|
|
|
|
- node_exporter_configure
|
|
|
|
|
2022-11-25 09:18:32 +00:00
|
|
|
- name: Configure
|
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: configure.yml
|
|
|
|
apply:
|
|
|
|
become: true
|
2022-09-22 14:38:42 +00:00
|
|
|
tags:
|
|
|
|
- node_exporter_configure
|
|
|
|
|
|
|
|
- name: Ensure Node Exporter is enabled on boot
|
|
|
|
become: true
|
2022-09-23 12:07:54 +00:00
|
|
|
ansible.builtin.systemd:
|
2022-09-22 14:38:42 +00:00
|
|
|
daemon_reload: true
|
|
|
|
name: node_exporter
|
|
|
|
enabled: true
|
|
|
|
state: started
|
|
|
|
when:
|
|
|
|
- not ansible_check_mode
|
|
|
|
tags:
|
|
|
|
- node_exporter_run
|