- name: ensure blackbox container is present podman_image: name: '{{ blackbox_container_image_name }}' tag: '{{ blackbox_container_image_tag }}' state: present pull: '{{ blackbox_exporter_pull_image|d(false)|bool }}' notify: - reload systemd - restart blackbox-exporter tags: - container - name: ensure blackbox-exporter system container is configured template: src: blackbox-exporter.container.j2 dest: /etc/containers/systemd/blackbox-exporter.container mode: u=rw,go=r owner: root group: root notify: - reload systemd - restart blackbox-exporter - name: ensure /etc/prometheus directory exists file: path: /etc/prometheus mode: u=rwx,go=rx owner: root group: root state: directory - name: ensure blackbox-exporter is configured copy: dest: /etc/prometheus/blackbox.yml content: | {{ blackbox_config|to_nice_yaml(indent=2) }} mode: u=rw,go=r owner: root group: root notify: - reload blackbox-exporter - name: flush handlers meta: flush_handlers - name: ensure blackbox-exporter starts at boot service: name: blackbox-exporter enabled: true tags: - service - name: flush_handlers meta: flush_handlers - name: ensure blackbox-exporter is running service: name: blackbox-exporter state: started tags: - service