--- - name: create group group: name: "{{ blackbox_exporter_group }}" system: true state: "{{ blackbox_exporter_group_state | default('present') }}" - name: create user user: name: "{{ blackbox_exporter_user }}" system: true shell: "{{ blackbox_exporter_user_shell }}" group: "{{ blackbox_exporter_group }}" createhome: false home: "{{ blackbox_exporter_var_path }}" state: "{{ blackbox_exporter_user_state | default('present') }}" - name: create etc path file: path: "{{ blackbox_exporter_etc_path }}" state: directory owner: "{{ blackbox_exporter_etc_owner }}" group: "{{ blackbox_exporter_etc_group }}" mode: "{{ blackbox_exporter_etc_mode }}" - name: configure copy: dest: "{{ blackbox_exporter_etc_path }}/config.yaml" content: "{{ (blackbox_exporter_config | default({})) | to_nice_yaml }}" owner: root group: root mode: 0444 notify: restart blackbox_exporter - name: configure systemd template template: src: blackbox_exporter.service.j2 dest: /etc/systemd/system/blackbox_exporter.service owner: root group: root mode: 0444 notify: restart blackbox_exporter - name: manage service service: name: "{{ blackbox_exporter_service_name }}" enabled: "{{ blackbox_exporter_service_enabled }}" state: "{{ blackbox_exporter_service_state }}"