---
- name: 1. Installation de systemd-journal-remote
  apt:
   name: systemd-journal-remote
   state: present

- name: 2. Enable et start systemd-journal-remote.socket
  systemd:
   name: systemd-journal-remote.socket
   enabled: yes
   state: started

- name: 3. Copie de systemd-journal-remote.service dans /etc/systemd/system
  copy:
   src: /lib/systemd/system/systemd-journal-remote.service
   dest: /etc/systemd/system/systemd-journal-remote.service
   remote_src: yes
   backup: yes


- name: 4. Modification de systemd-journal-remote.service
  replace:
   path: /etc/systemd/system/systemd-journal-remote.service
   regexp: '--listen-https=-3'
   replace: '--listen-http=-3'

- name: 5. active le mode SplitMode en mode Host
  replace:
   path: /etc/systemd/journal-remote.conf
   regexp: '^#\sSplitMode=host'
   replace: 'SplitMode=host'


- name: 6. Creation /var/log/journal/remote directory
  file:
   path: /var/log/journal/remote
   state: directory
   owner: systemd-journal-remote

- name: 7. Redemarrage de systemd
  systemd:
   daemon_reload: yes
     # notify:
     #- restart journald
