aboutsummaryrefslogtreecommitdiffstats
path: root/roles/journald/tasks/main.yml
blob: 163c417b94076518e6daaa752238e28eafe30fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- name: generate journald.conf
  template:
    src: etc/systemd/journald.conf.j2
    dest: /etc/systemd/journald.conf
  notify: restart journald

- name: set journald storage method
  file:
    path: /var/log/journal
    state: "{{ 'directory' if journald_persistent else 'absent' }}"
  register: journal_directory

- name: configure persistent journal
  block:
    - name: set journal directory permissions
      command: systemd-tmpfiles --create --prefix /var/log/journal

    - name: flush journal to disk
      command: journalctl --flush

  when:
    - journald_persistent
    - journal_directory.changed