From f139ba3fa6d2ed431ca411b2d35ddc3b5c9b1b68 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 22 Sep 2023 10:00:16 +0200 Subject: journald: move service restart to handlers --- roles/journald/handlers/main.yml | 6 ++++++ roles/journald/tasks/main.yml | 30 ++++++++++++------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 roles/journald/handlers/main.yml (limited to 'roles/journald') diff --git a/roles/journald/handlers/main.yml b/roles/journald/handlers/main.yml new file mode 100644 index 0000000..623d9ff --- /dev/null +++ b/roles/journald/handlers/main.yml @@ -0,0 +1,6 @@ +- name: Restart systemd-journald + become: true + ansible.builtin.systemd_service: + name: systemd-journald + state: restarted + listen: journald_restart diff --git a/roles/journald/tasks/main.yml b/roles/journald/tasks/main.yml index 53e3393..38113a5 100644 --- a/roles/journald/tasks/main.yml +++ b/roles/journald/tasks/main.yml @@ -1,20 +1,14 @@ -- name: Make journald less noisy +- name: Edit journald.conf become: true - block: - - name: Edit journald.conf - community.general.ini_file: - dest: /etc/systemd/journald.conf - section: Journal - option: MaxLevelStore - value: '{{ journald_log_level }}' - owner: root - group: root - mode: '644' - register: edited + community.general.ini_file: + dest: /etc/systemd/journald.conf + section: Journal + option: MaxLevelStore + value: '{{ journald_log_level }}' + owner: root + group: root + mode: '644' + notify: journald_restart - - name: Restart systemd-journald - ansible.builtin.systemd_service: - daemon_reload: true - name: systemd-journald - state: restarted - when: edited.changed +- name: Restart systemd-journald if necessary + ansible.builtin.meta: flush_handlers -- cgit v1.2.3