--- ## TODO: pin version - name: install apt packages apt: name: - prom-exporter-node - moreutils state: present - name: create directory for textfile collector file: path: /var/lib/prometheus-node-exporter/textfile-collector state: directory - name: generate systemd service unit template: src: service.j2 dest: /etc/systemd/system/prometheus-node-exporter.service notify: restart prometheus-node-exporter - name: make sure prometheus-node-exporter is enabled and started systemd: name: prometheus-node-exporter.service daemon_reload: yes state: started enabled: yes - name: register exporter copy: content: | location = /node { proxy_pass http://127.0.0.1:9100/metrics; } dest: /etc/prometheus/exporter/node.locations notify: reload nginx - name: create directory for textfile collector scripts file: path: /usr/local/share/prometheus-node-exporter state: directory - name: install the apt textfile collector script when: ansible_pkg_mgr == "apt" vars: textfile_collector_name: "apt" include_tasks: textfile_collector_generic.yml - name: install all other textfile collector scripts loop: "{{ prometheus_exporter_node_textfile_collector_scripts }}" loop_control: loop_var: textfile_collector_name include_tasks: "{{ q('first_found', ['textfile_collector_' + textfile_collector_name + '.yml', 'textfile_collector_generic.yml'] ) | first }}"