---
- name: Setup journald logs
  hosts: all

  tasks:

  - name: Create logs directory if it does not exist
    file:
      path: /var/log/journal
      state: directory
      owner: root
      group: systemd-journal
    when: ansible_os_family == 'Debian' or ansible_os_family == 'RedHat' or ansible_os_family == 'Suse'
    notify: Restart journald
  
  handlers:

  - name: Restart journald
    systemd:
      name: systemd-journald
      state: restarted