- name: install package (Debian) when: ansible_facts['distribution'] == "Debian" package: name: "{{ node_exporter_debian_package }}" - name: install package (Fedora) when: ansible_facts['distribution'] == "Fedora" package: name: "{{ node_exporter_fedora_package }}" - name: allow port ufw: rule: allow direction: in proto: tcp src: "{{ prometheus_server_ip }}" to_port: "{{ node_exporter_port }}" - name: enable service systemd: name: prometheus-node-exporter enabled: yes masked: no - name: restart service service: name: prometheus-node-exporter state: restarted