From b013a2d14b99eb3d76877e52f863832e421d3d70 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 31 Jul 2019 09:24:09 +0200 Subject: o Persisting journald logs by default. --- ansible/roles/trygvis-base/tasks/main.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ansible/roles/trygvis-base/tasks') diff --git a/ansible/roles/trygvis-base/tasks/main.yml b/ansible/roles/trygvis-base/tasks/main.yml index d753056..0fc5782 100644 --- a/ansible/roles/trygvis-base/tasks/main.yml +++ b/ansible/roles/trygvis-base/tasks/main.yml @@ -47,11 +47,30 @@ - trygvis-base-syslog when: trygvis_base__syslog block: - - name: - vars: + - vars: items: - rsyslog apt: name: "{{ items }}" state: present install_recommends: no + +- become: true + tags: + - trygvis-base + - trygvis-base-journald + when: trygvis_base__journald + block: + - stat: + path: /var/log/journal + register: journal_log + + - when: not (journal_log.stat.isdir is defined and journal_log.stat.isdir) + file: + path: /var/log/journal + state: directory + notify: reload journalctl + + - when: not (journal_log.stat.isdir is defined and journal_log.stat.isdir) + command: /bin/systemd-tmpfiles --create --prefix /var/log/journal + notify: reload journalctl -- cgit v1.2.3