feat(host): install and enable prometheus-node-exporter on all managed hosts
This commit is contained in:
1 parent
065c47aee2
commit
7b2f6790c4
2 files changed
+14
-16
No files matched your search
@@ -65,19 +65,4 @@ services:
|
||||
depends_on:
|
||||
- prometheus
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:v1.9.0
|
||||
container_name: monitoring-node-exporter
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.rootfs=/rootfs'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
ports:
|
||||
- "9100:9100"
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
- name: Применить настройки SSH
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Поставить Docker
|
||||
- name: Поставить системные пакеты и Docker
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker.io
|
||||
@@ -62,6 +62,7 @@
|
||||
- ufw
|
||||
- ca-certificates
|
||||
- curl
|
||||
- prometheus-node-exporter
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
@@ -71,12 +72,24 @@
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Включить prometheus-node-exporter
|
||||
ansible.builtin.systemd:
|
||||
name: prometheus-node-exporter
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Разрешить SSH
|
||||
ansible.builtin.command: ufw allow OpenSSH
|
||||
register: ufw_ssh
|
||||
changed_when: "'added' in (ufw_ssh.stdout | lower)"
|
||||
when: ansible_virtualization_type | default('') != 'lxc'
|
||||
|
||||
- name: Разрешить порт метрик node-exporter в firewall
|
||||
ansible.builtin.command: ufw allow 9100/tcp
|
||||
register: ufw_metrics
|
||||
changed_when: "'added' in (ufw_metrics.stdout | lower)"
|
||||
when: ansible_virtualization_type | default('') != 'lxc'
|
||||
|
||||
- name: Проверить состояние firewall
|
||||
ansible.builtin.command: ufw status
|
||||
register: ufw_status
|
||||
|
||||
Reference in new issue
Block a user