ansible-role-basic-system-s.../tasks/tmpreaper.yml

51 lines
1.4 KiB
YAML

---
- name: tmpreaper | Install tmpreaper on Debian/Ubuntu
when:
- tmpreaper_install
- ansible_distribution_file_variety == "Debian"
tags: tmpreaper
block:
- name: tmpreaper | Install tmpreaper
ansible.builtin.apt:
pkg: tmpreaper
state: present
cache_valid_time: 1800
- name: tmpreaper | Change the date check criteria from ctime to mtime
ansible.builtin.lineinfile:
path: /etc/cron.daily/tmpreaper
regexp: ^ --[c|m]time \\
line: " --mtime \\"
when: not tmpreaper_use_ctime
- name: tmpreaper | Change the date check criteria from mtime to ctime
ansible.builtin.lineinfile:
path: /etc/cron.daily/tmpreaper
regexp: ^ --[c|m]time \\
line: " --ctime \\"
when: tmpreaper_use_ctime
- name: tmpreaper | Install the tmpreaper configuration
ansible.builtin.template:
src: tmpreaper.conf.j2
dest: /etc/tmpreaper.conf
owner: root
group: root
mode: "0444"
- name: tmpreaper | Remove tmpreaper on Debian/Ubuntu
when:
- not tmpreaper_install
- ansible_distribution_file_variety == "Debian"
tags: tmpreaper
block:
- name: tmpreaper | Remove the tmpreaper package
ansible.builtin.apt:
pkg: tmpreaper
state: absent
- name: tmpreaper | Remove the tmpreaper configuration
ansible.builtin.file:
dest: /etc/tmpreaper.conf
state: absent