---
- name: configure uploaders
  hosts: all
  become: False
  ignore_unreachable: yes
  roles:
    - role: uploader-metrics
      become: True
    - role: uploaders
      become: True
    - role: downloaders
      become: True
      when: safe_downloader_instances | default(0) | int > 0

  tasks:
    # Something is wrong with the journal service on Ubuntu that causes no
    # output to be produced when running `journalctl`. The solution seemed
    # to be restarting the service.
    - name: restart systemd-journald
      become: True
      ansible.builtin.systemd:
        name: systemd-journald
        state: restarted
        enabled: yes
    # The Telegraf service seems to need to be rebooted for metrics to start transmitting.
    - name: restart telegraf
      become: True
      ansible.builtin.systemd:
        name: telegraf
        state: restarted
        enabled: yes