Migrate cronjobs to systemd-timers

Change-Id: I935d875700505a2fbaf9d2a0d642913110bd00f9
This commit is contained in:
Daniel 'f0o' Preussker 2025-04-11 11:38:32 +00:00
parent fe12436d2b
commit 47bb2829fb
2 changed files with 62 additions and 8 deletions

View File

@ -63,10 +63,37 @@
config_overrides: "{{ swift_drive_audit_conf_overrides }}"
config_type: "ini"
# TODO: This can be safely removed in 2025.2 cycle
- name: Create drive-audit cron job
ansible.builtin.cron:
name: "Run drive-audit script"
job: "{{ swift_bin }}/swift-drive-audit /etc/swift/drive-audit.conf"
minute: 15
cron_file: swift-drive-audit
user: root
state: absent
- name: Create drive-audit systemd timer
ansible.builtin.include_role:
name: systemd_service
vars:
systemd_service_restart_changed: false
systemd_user_name: "root"
systemd_group_name: "root"
systemd_tempd_prefix: openstack
systemd_slice_name: "{{ swift_system_slice_name }}"
systemd_lock_dir: "{{ swift_lock_dir }}"
systemd_service_restart: on-abnormal
systemd_services:
- service_name: "swift-drive-audit"
execstarts:
- "{{ swift_bin }}/swift-drive-audit /etc/swift/drive-audit.conf"
environment:
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: "swift-drive-audit"
enabled: true
timer:
state: 'started'
enabled: true
options:
OnCalendar: "*:0/15"
Persistent: true
Unit: "swift-drive-audit.service"

View File

@ -54,13 +54,40 @@
when: ansible_facts['pkg_mgr'] =="apt"
notify: "Restart rsync service"
# TODO: This can be safely removed in 2025.2 cycle
- name: "Setup swift-recon-cron cron job"
ansible.builtin.cron:
name: "swift-recon-cron run"
minute: "*/5"
user: "swift"
job: "{{ recon_cron_path }} /etc/swift/object-server/object-server.conf"
cron_file: "swift_recon_cron"
state: absent
- name: Setup swift-recon-cron systemd timer
ansible.builtin.include_role:
name: systemd_service
vars:
systemd_service_restart_changed: false
systemd_user_name: "{{ swift_system_user_name }}"
systemd_group_name: "{{ swift_system_group_name }}"
systemd_tempd_prefix: openstack
systemd_slice_name: "{{ swift_system_slice_name }}"
systemd_lock_dir: "{{ swift_lock_dir }}"
systemd_service_restart: on-abnormal
systemd_services:
- service_name: "swift-recon-cron"
execstarts:
- "{{ recon_cron_path }} /etc/swift/object-server/object-server.conf"
environment:
UMASK: "0640"
UMASK_DIR: "0750"
program_sandboxing:
RuntimeDirectory: "swift-recon-cron"
enabled: true
timer:
state: 'started'
enabled: true
options:
OnCalendar: "*:0/5"
Persistent: true
Unit: "swift-recon-cron.service"
- name: "Set ownership on mounted drives"
ansible.builtin.file: