--- - name: Install packages ansible.builtin.package: name: blackbox_exporter state: installed - name: Add user to hostkey group ansible.builtin.user: name: _blackboxexporter groups: hostkey append: true create_home: false notify: Restart blackbox_exporter - name: Create main config ansible.builtin.copy: dest: /etc/blackbox_exporter/blackbox.yml src: blackbox.yml mode: "0644" owner: root group: "{{ ansible_wheel }}" notify: Restart blackbox_exporter - name: Create web-config ansible.builtin.template: dest: /etc/blackbox_exporter/web-config.yml src: web-config.yml.j2 mode: "0644" owner: root group: "{{ ansible_wheel }}" notify: Restart blackbox_exporter - name: Enable service ansible.builtin.service: name: blackbox_exporter state: started arguments: > --config.file=/etc/blackbox_exporter/blackbox.yml --web.config.file=/etc/blackbox_exporter/web-config.yml enabled: true