Optionally change the tmpreaper behaviour.

This commit is contained in:
Andrea Dell'Amico 2022-12-23 17:33:43 +01:00
parent af8bdeb472
commit 1babb21f19
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 26 additions and 19 deletions

View File

@ -132,7 +132,8 @@ nfs_server_ganesha_exports: []
# - hostN
# tmpreaper
tmpreaper_install: False
tmpreaper_install: false
mpreaper_use_ctime: true
tmpreaper_protect_extra: ''
tmpreaper_dirs: '/tmp/.'
tmpreaper_extra_dirs: ''

View File

@ -1,13 +1,14 @@
galaxy_info:
author: Andrea Dell'Amico
description: Systems Architect
description: Perform some low level system configuration
company: ISTI-CNR
role_name: basic_system_setup
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
license: EUPL 1.2+
min_ansible_version: 2.8
min_ansible_version: "2.9"
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
@ -18,8 +19,8 @@ galaxy_info:
- bionic
- name: EL
versions:
- 7
- 8
- "7"
- "8"
galaxy_tags:
- os-setup

View File

@ -1,26 +1,31 @@
---
- name: Install tmpreaper on Debian/Ubuntu
block:
- name: Install tmpreaper
apt: pkg=tmpreaper state=latest cache_valid_time=1800
- name: Install the tmpreaper configuration
template: src=tmpreaper.conf.j2 dest=/etc/tmpreaper.conf owner=root group=root mode=0444
when:
- tmpreaper_install
- ansible_distribution_file_variety == "Debian"
tags: tmpreaper
block:
- name: Install tmpreaper
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
regexp: "^ --ctime \"
line: "^ --mtime \"
when: not mpreaper_use_ctime
- name: Install the tmpreaper configuration
ansible.builtin.template: src=tmpreaper.conf.j2 dest=/etc/tmpreaper.conf owner=root group=root mode=0444
- name: Remove tmpreaper on Debian/Ubuntu
block:
- name: Remove the tmpreaper package
apt: pkg=tmpreaper state=absent
- name: Remove the tmpreaper configuration
file: dest=/etc/tmpreaper.conf state=absent
when:
- not tmpreaper_install
- ansible_distribution_file_variety == "Debian"
tags: tmpreaper
block:
- name: Remove the tmpreaper package
ansible.builtin.apt: pkg=tmpreaper state=absent
- name: Remove the tmpreaper configuration
ansible.builtin.file: dest=/etc/tmpreaper.conf state=absent