--- - name: "Include OS-specific variables" ansible.builtin.include_vars: "{{ ansible_facts['os_family'] | lower }}.yml" - name: "Ensure prometheus-node-exporter is installed" become: true ansible.builtin.package: name: "prometheus-node-exporter" state: "present" - name: "Configure node-exporter host/port via environment file" become: true ansible.builtin.copy: content: | NODE_EXPORTER_ARGS=" --web.listen-address={{ node_exporter_host }}:{{ node_exporter_port }} --collector.systemd " dest: "{{ node_exporter_env_file }}" mode: "0644" notify: "Restart node-exporter" - name: "Start and enable prometheus-node-exporter" become: true ansible.builtin.systemd_service: name: "prometheus-node-exporter" state: "started" enabled: true