- name: install prometheus package: name: - prometheus - node_exporter state: present - name: generate prometheus configuration template: src: prometheus.conf.j2 dest: "{{ prometheus_configuration_file }}" owner: 0 group: 0 mode: 0644 - name: enable and restart prometheus services service: name: "{{ item }}" state: restarted enabled: true loop: - prometheus - node_exporter