mirror of
https://gitea.0xace.cc/ansible-galaxy/node-exporter.git
synced 2025-06-28 21:13:07 +00:00
first commit
This commit is contained in:
20
tasks/Debian.yaml
Normal file
20
tasks/Debian.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Add the user 'prometheus' for node_exporter
|
||||
ansible.builtin.user:
|
||||
name: prometheus
|
||||
shell: /usr/sbin/nologin
|
||||
append: yes
|
||||
home: /var/lib/prometheus
|
||||
|
||||
- name: Ensure {{ node_exporter_package }} installed
|
||||
apt:
|
||||
name: "{{ node_exporter_package }}"
|
||||
state: present
|
||||
|
||||
- name: Enable and start node_exporter
|
||||
systemd:
|
||||
name: "{{ node_exporter_unit_name }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
masked: no
|
||||
daemon_reload: yes
|
13
tasks/RedHat.yaml
Normal file
13
tasks/RedHat.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Ensure node_exporter version {{ node_exporter_version }} installed
|
||||
dnf:
|
||||
name: "node_exporter-{{ node_exporter_version }}"
|
||||
state: present
|
||||
|
||||
- name: Enable and start node_exporter
|
||||
systemd:
|
||||
name: node_exporter
|
||||
state: started
|
||||
enabled: yes
|
||||
masked: no
|
||||
daemon_reload: yes
|
17
tasks/main.yaml
Normal file
17
tasks/main.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Load a variable file based on the OS type
|
||||
include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}.yaml"
|
||||
paths:
|
||||
- "vars"
|
||||
tags: node_exporter_vars
|
||||
|
||||
- name: Include node_exporter install
|
||||
include_tasks: "{{ ansible_facts['os_family'] }}.yaml"
|
Reference in New Issue
Block a user