journald.yml 884 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Checking for journald.conf
  3. stat:
  4. path: /etc/systemd/journald.conf
  5. get_checksum: false
  6. get_attributes: false
  7. get_mime: false
  8. register: journald_conf_file
  9. - name: Create journald persistence directories
  10. file:
  11. path: /var/log/journal
  12. state: directory
  13. - name: Update journald setup
  14. replace:
  15. dest: /etc/systemd/journald.conf
  16. regexp: '^(\#| )?{{ item.var }}=\s*.*?$'
  17. replace: ' {{ item.var }}={{ item.val }}'
  18. backup: yes
  19. with_items: "{{ journald_vars_to_replace | default([]) }}"
  20. when: journald_conf_file.stat.exists
  21. register: journald_update
  22. # I need to restart journald immediatelly, otherwise it gets into way during
  23. # further steps in ansible
  24. - name: Restart journald
  25. command: "systemctl restart systemd-journald"
  26. retries: 3
  27. delay: 5
  28. register: result
  29. until: result.rc == 0
  30. when: journald_update is changed