]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: Install tmpreaper/tmpwatch and clean /tmp daily 1745/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 18 Feb 2021 18:22:53 +0000 (13:22 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 18 Feb 2021 18:47:42 +0000 (13:47 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/examples/slave.yml

index 47b53a0199091c13c78ecda81d7346c180d69666..7d3405609ebc26b8e76ab8e576a5059c0a251553 100644 (file)
@@ -55,6 +55,8 @@
           - doxygen
           - ditaa
           - ant
+          - tmpreaper
+        tmp_cleaner_name: tmpreaper
       when: ansible_os_family == "Debian"
 
     # Libvirt DEBs (Bionic and older)
           - rpmdevtools
           - openssl-devel
           - libffi-devel
+          - tmpwatch
+        tmp_cleaner_name: tmpwatch
       when: ansible_os_family == "RedHat"
 
     # Libvirt RPMs
             line: '%dist .el{{ ansible_distribution_major_version }}'
       when: ansible_os_family == "RedHat"
 
+    ## tmpwatch/tmpreaper TASKS
+    - name: tmpwatch/tmpreaper Tasks
+      block:
+        # In case we're running 'ansible-playbook --tags tmp'
+        - name: "Make sure {{ tmp_cleaner_name }} is installed"
+          package:
+            name: "{{ tmp_cleaner_name }}"
+            state: present
+
+        - name: Disable tmpreaper cron.daily timer
+          file:
+            path: /etc/cron.daily/tmpreaper
+            state: absent
+          when: ansible_os_family == "Debian"
+
+        - name: Create tmp cleaning cronjob
+          cron:
+            name: "Delete /tmp files that have not been accessed in 30 days"
+            special_time: daily
+            job: "{{ tmp_cleaner_name }} 30d /tmp/"
+      when: permanent|bool
+      tags: tmp
+
     ## GITCONFIG TASKS
     - name: Ensure the gitconfig file exists
       shell: printf "[user]\name=Ceph CI\nemail=ceph-release-team@redhat.com\n" > /home/{{ jenkins_user }}/.gitconfig