- hosts:
    - coregonus
    - hash
    - knot
  tasks:

    # otelcol-contrib.deb needs to be installed first
    # adduser otelcol-contrib systemd-journal

    - name: /etc/otelcol-contrib/config.yaml
      become: yes
      template:
        src: otelcol-contrib/config.yaml
        dest: /etc/otelcol-contrib/config.yaml
      notify: systemctl restart otelcol-contrib

    - name: mkdir /var/lib/otelcol/file_storage
      become: yes
      file:
        path: /var/lib/otelcol/file_storage
        owner: otelcol-contrib
      notify: systemctl restart otelcol-contrib

  handlers:
    - name: systemctl restart otelcol-contrib
      become: yes
      systemd:
        service: otelcol-contrib
        state: restarted