--- - name: generate apt pin file for exporter-smokeping package when: prometheus_exporter_smokeping_version is defined copy: dest: "/etc/apt/preferences.d/prom-exporter-smokeping.pref" content: | Package: prom-exporter-smokeping Pin: version {{ prometheus_exporter_smokeping_version }}-1 Pin-Priority: 1001 - name: remove apt pin file for exporter-smokeping package when: prometheus_exporter_smokeping_version is not defined file: path: "/etc/apt/preferences.d/prom-exporter-smokeping.pref" state: absent - name: install apt packages apt: name: "prom-exporter-smokeping{% if prometheus_exporter_smokeping_version is defined %}={{ prometheus_exporter_smokeping_version }}-1{% endif %}" state: present allow_downgrade: yes notify: restart prometheus-smokeping-exporter - name: create config directory file: path: /etc/prometheus/exporter/smokeping state: directory - name: generate configuration template: src: config.yml.j2 dest: /etc/prometheus/exporter/smokeping/config.yml owner: root group: prometheus-exporter mode: 0640 notify: restart prometheus-smokeping-exporter - name: generate systemd service unit template: src: service.j2 dest: /etc/systemd/system/prometheus-smokeping-exporter.service notify: restart prometheus-smokeping-exporter - name: make sure prometheus-smokeping-exporter is enabled and started systemd: name: prometheus-smokeping-exporter.service daemon_reload: yes state: started enabled: yes - name: register exporter copy: content: | location = /smokeping { proxy_pass http://127.0.0.1:9374/metrics; } dest: /etc/prometheus/exporter/smokeping.locations notify: reload nginx