Add ability to define a config for journald

At the moment we aim to make systemd-journald a universal destination
for log files across services. With that there is currently no way
of configuring journald using OSA. While this might be
neat for production deployments, it's very valuable to have for CI
as well.

Change-Id: I70a8c9266cb12811a58f5a183955dbec319e539f
(cherry picked from commit 65f28c5bb4)
This commit is contained in:
Dmitriy Rabotyagov 2023-08-21 17:16:50 +02:00 committed by Dmitriy Rabotyagov
parent ba5fba117a
commit c2ee32b71b
4 changed files with 35 additions and 1 deletions

View File

@ -172,6 +172,8 @@ openstack_hosts_power_tool_enable: "{{ ('repo_all' in groups or 'manila_all' in
# Keep a history of systemd journals on disk after reboots
openstack_host_keep_journals: yes
# Define arbitrary configration for systemd-journald
openstack_hosts_journald_config: {}
# Enable/Disable the yum fastestmirror plugin
openstack_hosts_enable_yum_fastestmirror: yes

View File

@ -0,0 +1,5 @@
---
features:
- |
Added variable ``openstack_host_journald_config`` that allows to supply
arbitrary configuration for systemd-journald as a mapping.

View File

@ -171,6 +171,11 @@
tags:
- openstack_hosts-config
- openstack_hosts-systemd
when: openstack_hosts_systemd_networkd_devices or openstack_hosts_systemd_networkd_networks or openstack_hosts_systemd_services or openstack_hosts_systemd_mounts
when:
- openstack_hosts_systemd_networkd_devices or
openstack_hosts_systemd_networkd_networks or
openstack_hosts_systemd_services or
openstack_hosts_systemd_mounts or
openstack_hosts_journald_config
tags:
- always

View File

@ -42,3 +42,25 @@
systemd_mounts: "{{ openstack_hosts_systemd_mounts }}"
when:
- openstack_hosts_systemd_mounts
- name: Configure systemd-journald
when: openstack_hosts_journald_config
block:
- name: Create /etc/systemd/journald.conf.d directory
file:
path: /etc/systemd/journald.conf.d
state: directory
owner: root
group: systemd-journal
mode: "0755"
- name: Define journald configuration
copy:
content: |-
[Journal]
{% for key, value in openstack_hosts_journald_config.items() %}
{{ key }}={{ value }}
{% endfor %}
dest: /etc/systemd/journald.conf.d/99-osa-journal.conf
notify:
- Restart systemd-journald