diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-07-31 09:24:09 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-08-08 09:03:13 +0200 |
commit | b013a2d14b99eb3d76877e52f863832e421d3d70 (patch) | |
tree | b3d46fe1f681e9f1fe8b7da376d186302bd04f18 /ansible | |
parent | d50110f25674f218dd7e528a6a74fbbe04599688 (diff) | |
download | infra-b013a2d14b99eb3d76877e52f863832e421d3d70.tar.gz infra-b013a2d14b99eb3d76877e52f863832e421d3d70.tar.bz2 infra-b013a2d14b99eb3d76877e52f863832e421d3d70.tar.xz infra-b013a2d14b99eb3d76877e52f863832e421d3d70.zip |
o Persisting journald logs by default.
Diffstat (limited to 'ansible')
-rw-r--r-- | ansible/roles/trygvis-base/defaults/main.yml | 1 | ||||
-rw-r--r-- | ansible/roles/trygvis-base/handlers/main.yml | 4 | ||||
-rw-r--r-- | ansible/roles/trygvis-base/tasks/main.yml | 23 |
3 files changed, 26 insertions, 2 deletions
diff --git a/ansible/roles/trygvis-base/defaults/main.yml b/ansible/roles/trygvis-base/defaults/main.yml index 8244bbf..e45da41 100644 --- a/ansible/roles/trygvis-base/defaults/main.yml +++ b/ansible/roles/trygvis-base/defaults/main.yml @@ -1,6 +1,7 @@ trygvis_base__etc_localtime: yes trygvis_base__remove_root_authorized_keys: yes trygvis_base__fix_aliases: yes +trygvis_base__journald: yes # These mostly applies to LXC hosts trygvis_base__fix_hosts: no diff --git a/ansible/roles/trygvis-base/handlers/main.yml b/ansible/roles/trygvis-base/handlers/main.yml index f06ad24..cbba9a3 100644 --- a/ansible/roles/trygvis-base/handlers/main.yml +++ b/ansible/roles/trygvis-base/handlers/main.yml @@ -5,3 +5,7 @@ - name: postalias /etc/aliases become: yes shell: "[ ! -x /usr/sbin/postalias ] || /usr/sbin/postalias /etc/aliases" + +- name: reload journalctl + become: yes + command: /usr/bin/pkill -f -USR1 systemd-journald 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 |