Skip to content

Commit

Permalink
make journald_sync_interval only applicable to persistent mode
Browse files Browse the repository at this point in the history
  • Loading branch information
richm committed Jan 15, 2024
1 parent 356fe13 commit 0edda0c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ unless otherwise indicated.

- `journald_sync_interval` - integer variable, in minutes, configures the time
span after which journald synchronizes the currently used journal file to
disk. By default role doesn't alter currently used value.
disk. By default role doesn't alter currently used value. This setting is
only applicable for `journald_persistent: true`. You will get a warning if
set otherwise.

- `journald_forward_to_syslog` - boolean variable, control whether log messages
received by the journal daemon shall be forwarded to a traditional syslog
Expand Down
9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
- name: Set platform/version specific variables
include_tasks: tasks/set_vars.yml

- name: Warn if journald_sync_interval is set in volatile mode
debug:
msg: >-
WARNING - journald_sync_interval should not be set when
journald_persistent: false
when:
- journald_sync_interval | int != 0
- not journald_persistent

- name: Ensure required packages are installed
package:
name: "{{ __journald_packages }}"
Expand Down
6 changes: 3 additions & 3 deletions templates/journald.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ SystemMaxFiles={{ journald_max_files }}
SystemMaxFileSize={{ journald_max_file_size }}M
{% endif %}
SplitMode={{ journald_per_user | bool | ternary("uid", "none") }}
{% if journald_sync_interval | int != 0 %}
SyncIntervalSec={{ journald_sync_interval }}m
{% endif %}
{# Volatile journal #}
{% else %}
Storage=volatile
Expand All @@ -31,8 +34,5 @@ RuntimeMaxFileSize={{ journald_max_file_size }}M
{% endif %}
{# end of storage specific settings #}
{# settings below here apply to all storage types #}
{% if journald_sync_interval | int != 0 %}
SyncIntervalSec={{ journald_sync_interval }}m
{% endif %}
Compress={{ journald_compression | bool | ternary("yes", "no") }}
ForwardToSyslog={{ journald_forward_to_syslog | bool | ternary("yes", "no") }}

0 comments on commit 0edda0c

Please sign in to comment.