Use tmpfiles.d to create /var/run/reprepro

The mirror-update server uses /var/run/reprepro to stash reprepro flock
files. We do that to ensure that we don't have stale locks after a
reboot bceause /var/run is cleaned on reboot. Problem is we rely on
daily ansible runs to recreate this dir which means that after a reboot
we can wait up to 24 hours before we get reprepro mirroring again.

Fix this via the use of tmpfiles.d which instructs systemd to create the
dir for us on boot. We specifically note (via the !) that this directory
should only be created on boot and we set the age value to - to prevent
systemd from deleting this directory.

Change-Id: I68e49475c54e756ce5a6933390dbe13ace976c29
This commit is contained in:
Clark Boylan 2021-06-11 15:35:56 -07:00
parent ca60545eb1
commit d72012fceb

View File

@ -49,6 +49,19 @@
group: root
mode: '0755'
- name: Ensure run directory at boot
copy:
# d means create this directory
# ! means only evaluate this on boot, creating the dir outside of boot
# can break things
# 0755 root root sets perms and ownership
# - omits the age value which means do not delete this directory
content: "d! /var/run/reprepro 0755 root root -"
dest: /etc/tmpfiles.d/reprepro.conf
owner: root
group: root
mode: '0644'
- name: Rotate logfiles
include_role:
name: logrotate