diff --git a/ansible/roles/core-mon/monitoring/templates/compose.yaml.j2 b/ansible/roles/core-mon/monitoring/templates/compose.yaml.j2 index 4d23e1d..4ad37b7 100644 --- a/ansible/roles/core-mon/monitoring/templates/compose.yaml.j2 +++ b/ansible/roles/core-mon/monitoring/templates/compose.yaml.j2 @@ -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" diff --git a/ansible/roles/host/tasks/main.yml b/ansible/roles/host/tasks/main.yml index f053ac1..4180071 100644 --- a/ansible/roles/host/tasks/main.yml +++ b/ansible/roles/host/tasks/main.yml @@ -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