--- - include_vars: vars/secrets.yml - file: path: "{{ item }}" state: directory mode: 0777 with_items: - /srv/prometheus/etc/prometheus - /srv/prometheus/prometheus - name: Install prometheus.yml template: src: templates/etc/{{ item }} dest: /srv/prometheus/etc/prometheus/{{ item }} mode: 644 owner: root group: root with_items: - prometheus.yml - name: Install other settings files. copy: src: templates/etc/{{ item }} dest: /srv/prometheus/etc/prometheus/{{ item }} mode: 644 owner: root group: root with_items: - alerting.rules - targets.json tags: - service-files - name: Install service files. template: src: templates/prometheus.service dest: /etc/systemd/system/prometheus.service mode: 644 owner: root group: root tags: - service-files - name: install service files command: systemctl daemon-reload - name: enable service at boot systemd: name: prometheus.service enabled: yes - name: make sure servcies are started. systemd: name: prometheus.service state: restarted tags: - start-service