journald.yml 752 B

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