2020-10-29 18:21:13 +01:00
|
|
|
---
|
|
|
|
- name: Install tmpreaper on Debian/Ubuntu
|
2022-12-23 17:33:43 +01:00
|
|
|
when:
|
|
|
|
- tmpreaper_install
|
|
|
|
- ansible_distribution_file_variety == "Debian"
|
|
|
|
tags: tmpreaper
|
2020-10-29 18:21:13 +01:00
|
|
|
block:
|
|
|
|
- name: Install tmpreaper
|
2022-12-23 17:33:43 +01:00
|
|
|
ansible.builtin.apt: pkg=tmpreaper state=latest cache_valid_time=1800
|
|
|
|
|
|
|
|
- name: Change the date check criteria from ctime to mtime
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/cron.daily/tmpreaper
|
2022-12-23 17:48:53 +01:00
|
|
|
regexp: '^ --[c|m]time \\'
|
2022-12-23 17:40:35 +01:00
|
|
|
line: ' --mtime \'
|
2022-12-23 17:37:02 +01:00
|
|
|
when: not tmpreaper_use_ctime
|
2020-10-29 18:21:13 +01:00
|
|
|
|
2022-12-23 17:50:25 +01:00
|
|
|
- name: Change the date check criteria from mtime to ctime
|
2022-12-23 17:48:53 +01:00
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/cron.daily/tmpreaper
|
|
|
|
regexp: '^ --[c|m]time \\'
|
|
|
|
line: ' --ctime \'
|
|
|
|
when: tmpreaper_use_ctime
|
|
|
|
|
2020-10-29 18:21:13 +01:00
|
|
|
- name: Install the tmpreaper configuration
|
2022-12-23 17:33:43 +01:00
|
|
|
ansible.builtin.template: src=tmpreaper.conf.j2 dest=/etc/tmpreaper.conf owner=root group=root mode=0444
|
2020-10-29 18:21:13 +01:00
|
|
|
|
2022-12-23 17:33:43 +01:00
|
|
|
- name: Remove tmpreaper on Debian/Ubuntu
|
2020-10-29 18:21:13 +01:00
|
|
|
when:
|
2022-12-23 17:33:43 +01:00
|
|
|
- not tmpreaper_install
|
2020-10-29 18:21:13 +01:00
|
|
|
- ansible_distribution_file_variety == "Debian"
|
|
|
|
tags: tmpreaper
|
|
|
|
block:
|
|
|
|
- name: Remove the tmpreaper package
|
2022-12-23 17:33:43 +01:00
|
|
|
ansible.builtin.apt: pkg=tmpreaper state=absent
|
2020-10-29 18:21:13 +01:00
|
|
|
|
|
|
|
- name: Remove the tmpreaper configuration
|
2022-12-23 17:33:43 +01:00
|
|
|
ansible.builtin.file: dest=/etc/tmpreaper.conf state=absent
|