Skip to content

Commit

Permalink
Merge pull request #291 from stackhpc/persistent-journal
Browse files Browse the repository at this point in the history
Backport persistent journal
  • Loading branch information
markgoddard authored Jun 27, 2024
2 parents 42e20f4 + 0bb98c6 commit f2a8902
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions ansible/infra-vm-host-configure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- import_playbook: "ssh-known-host.yml"
- import_playbook: "kayobe-ansible-user.yml"
- import_playbook: "logging.yml"
- import_playbook: "proxy.yml"
- import_playbook: "apt.yml"
- import_playbook: "dnf.yml"
Expand Down
9 changes: 9 additions & 0 deletions ansible/inventory/group_vars/all/logging
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
###############################################################################
# Logging configuration

# Journald storage. One of: volatile, persistent, auto, or none. Defaults to
# `persistent`.
journald_storage: persistent

###############################################################################
51 changes: 51 additions & 0 deletions ansible/logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
- name: Ensure Logging configuration is applied
hosts: seed-hypervisor:seed:overcloud:infra-vms
gather_facts: false
vars:
# NOTE(wszumski): Kayobe target env does not yet exist.
ansible_python_interpreter: /usr/bin/python3
tags:
- logging
tasks:
- name: Create /var/log/journal
become: true
file:
path: /var/log/journal
owner: "root"
group: "root"
mode: 0755
state: directory
notify: Flush journal to disk
when: journald_storage == "persistent"

- name: Ensure journald drop in directory exists
file:
path: "/etc/systemd/journald.conf.d/"
owner: "root"
group: "root"
mode: 0770
state: directory
become: true

- name: Ensure journald.conf overrides are set
copy:
content: |
[Journal]
Storage={{ journald_storage }}
dest: /etc/systemd/journald.conf.d/kayobe.conf
owner: root
group: root
mode: 0660
become: true
notify: Restart journald

handlers:
- name: Restart journald
service:
name: systemd-journald
state: restarted
become: true
- name: Flush journal to disk
become: true
command: journalctl --flush
1 change: 1 addition & 0 deletions ansible/overcloud-host-configure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- import_playbook: "ssh-known-host.yml"
- import_playbook: "kayobe-ansible-user.yml"
- import_playbook: "logging.yml"
- import_playbook: "proxy.yml"
- import_playbook: "apt.yml"
- import_playbook: "dnf.yml"
Expand Down
1 change: 1 addition & 0 deletions ansible/seed-host-configure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- import_playbook: "ssh-known-host.yml"
- import_playbook: "kayobe-ansible-user.yml"
- import_playbook: "logging.yml"
- import_playbook: "proxy.yml"
- import_playbook: "apt.yml"
- import_playbook: "dnf.yml"
Expand Down
1 change: 1 addition & 0 deletions ansible/seed-hypervisor-host-configure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- import_playbook: "ssh-known-host.yml"
- import_playbook: "kayobe-ansible-user.yml"
- import_playbook: "logging.yml"
- import_playbook: "proxy.yml"
- import_playbook: "apt.yml"
- import_playbook: "dnf.yml"
Expand Down
22 changes: 22 additions & 0 deletions doc/source/configuration/reference/hosts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1405,3 +1405,25 @@ Installing packages required by Kolla Ansible

A small number of packages are required to be installed on the hosts for Kolla
Ansible and the services that it deploys, while some others must be removed.

Logging
=======
*tags:*
| ``logging``
Kayobe will configure persistent logging for nodes in the following ansible groups:

- seed-hypervisor
- seed
- overcloud
- infra-vms

This means that the systemd journal will be written to local storage (instead
of to memory) and will allow you to view the journal from previous boots. The
storage limit defaults to 10% of the filesystem with a 4GiB hard limit (when
using journald defaults). See `journald documentation
<https://www.freedesktop.org/software/systemd/man/latest/journald.conf.html#SystemMaxUse=>`__
for more details.

Should you wish to disable this feature, you can set ``journald_storage`` to
``volatile``.
11 changes: 11 additions & 0 deletions etc/kayobe/logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
###############################################################################
# Logging configuration

# Journald storage. One of: volatile, persistent, auto, or none. Defaults to
# `persistent`.
#journald_storage:

###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
features:
- |
Configures journald to use a persistent storage by default. This allows you
to keep journald logs across reboots and is controlled by the
``journald_storage`` variable. See :kayobe-doc:`Kayobe documentation
<configuration/reference/hosts#logging>` for more details.

0 comments on commit f2a8902

Please sign in to comment.