Keep persistent systemd journals

This patch enables persistent systemd journals and allows a deployer
to disable the option if needed. The disk space requirements are
extremely low since the files are stored in binary format. It is
significantly less storage than rsyslog requires.

Closes-Bug: 1748195
Change-Id: I4de267f2839c5022e83a07fa7779f242808df5c0
This commit is contained in:
Major Hayden 2018-02-08 07:52:08 -06:00
parent bb153f9144
commit 181f6cea3a
No known key found for this signature in database
GPG Key ID: 737051E0C1011FB1
4 changed files with 40 additions and 0 deletions

View File

@ -144,3 +144,6 @@ opensuse_mirror_obs: "{{ opensuse_mirror }}"
opensuse_repo_oss_url: "{{ opensuse_mirror }}/distribution/leap/{{ ansible_distribution_version }}/repo/oss/"
opensuse_repo_update_url: "{{ opensuse_mirror }}/update/leap/{{ ansible_distribution_version }}/oss/"
opensuse_obs_cloud_repo_url: "{{ opensuse_mirror_obs }}/repositories/Cloud:/OpenStack:/Pike/openSUSE_Leap_{{ ansible_distribution_version }}"
# Keep a history of systemd journals on disk after reboots
openstack_host_keep_journals: yes

View File

@ -18,3 +18,9 @@
name: "sysstat"
state: "restarted"
enabled: "yes"
- name: Restart systemd-journald
service:
name: systemd-journald
state: restarted
enabled: yes

View File

@ -0,0 +1,10 @@
---
features:
- |
Persistent systemd journals are now enabled. This allows deployers to keep
older systemd journals on disk for review. The disk space requirements are
extremely low since the journals are stored in binary format. The default
location for persistent journals is in ``/var/log/journal``.
Deployers can opt out of this change by setting
``openstack_host_keep_journals`` to ``no``.

View File

@ -85,3 +85,24 @@
- name: Configure sysstat
include: openstack_sysstat.yml
when: openstack_host_sysstat_enabled | bool
- name: Create a directory to hold systemd journals on disk
file:
path: /var/log/journal
state: directory
register: journald_directory
when:
- openstack_host_keep_journals | bool
# NOTE(mhayden): The linter is skipped here since the command does not create
# any files. The command ensures that proper permissions and SELinux contests
# are set.
- name: Create tmpfiles structure in journald directory
command: systemd-tmpfiles --create --prefix /var/log/journal
when:
- journald_directory | changed
- openstack_host_keep_journals | bool
notify:
- Restart systemd-journald
tags:
- skip_ansible_lint