Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: disable service start limit to avoid errors during testing #89

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tests/tests_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,45 @@
journald_forward_to_syslog: true
journald_rate_limit_burst: 2000
journald_rate_limit_interval_sec: 2
__service_files:
- systemd-journald.service
- systemd-journal-flush.service

tasks:
- name: Run test
block:
- name: Make a copy of the service files
copy:
src: /usr/lib/systemd/system/{{ item }}
dest: /etc/systemd/system/{{ item }}
remote_src: true
mode: preserve
loop: "{{ __service_files }}"

- name: Change the startlimit to avoid errors with excessive journald restarts
lineinfile:
path: /etc/systemd/system/{{ item }}
insertafter: ^\[Unit\]
line: StartLimitIntervalSec=0
loop: "{{ __service_files }}"

- name: Make a copy of the systemd-journald.service
copy:
src: /usr/lib/systemd/system/systemd-journald.service
dest: /etc/systemd/system/systemd-journald.service
remote_src: true
mode: preserve

- name: Change the startlimit to avoid errors with excessive journald restarts
lineinfile:
path: /etc/systemd/system/systemd-journald.service
insertafter: ^\[Unit\]
line: StartLimitIntervalSec=0

- name: Reload systemd to ensure startlimit changes take effect upon restart
systemd:
daemon_reload: true

- name: Run the role
include_role:
name: linux-system-roles.journald
Expand Down Expand Up @@ -109,6 +144,16 @@
path: "{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
state: absent

- name: Remove copy of the service files
file:
path: /etc/systemd/system/{{ item }}
state: absent
loop: "{{ __service_files }}"

- name: Reload systemd to cleanup
systemd:
daemon_reload: true

- name: Restart journald services
service:
name: "{{ item }}"
Expand Down
Loading