From d72012fceb3223203e95791ee5e53d51001dbd37 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 11 Jun 2021 15:35:56 -0700 Subject: [PATCH] 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 --- playbooks/roles/reprepro/tasks/main.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/playbooks/roles/reprepro/tasks/main.yaml b/playbooks/roles/reprepro/tasks/main.yaml index 6f60848b92..3a5475c624 100644 --- a/playbooks/roles/reprepro/tasks/main.yaml +++ b/playbooks/roles/reprepro/tasks/main.yaml @@ -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