Manage tmpreaper on deb systems

This commit is contained in:
Andrea Dell'Amico 2020-10-29 18:21:13 +01:00
parent dff7c03996
commit 39e191f0fb
4 changed files with 43 additions and 0 deletions

View File

@ -11,6 +11,15 @@ locales_list:
- { name: 'it_IT.UTF-8' }
- { name: 'it_IT' }
# tmpreaper
tmpreaper_install: False
tmpreaper_protect_extra: ''
tmpreaper_dirs: '/tmp/.'
tmpreaper_delay: '256'
tmpreaper_additional_options: ''
tmpreaper_time: '7d'
#
enable_env_proxy: False
env_proxy_http_host: 'localhost'
env_proxy_http_port: '3128'

View File

@ -3,3 +3,4 @@
- import_tasks: locale.yml
- import_tasks: timezone.yml
- import_tasks: http_client_proxy.yml
- import_tasks: tmpreaper.yml

26
tasks/tmpreaper.yml Normal file
View File

@ -0,0 +1,26 @@
---
- 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
- 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

View File

@ -0,0 +1,7 @@
#
TMPREAPER_TIME={{ tmpreaper_time }}
TMPREAPER_PROTECT_EXTRA='{{ tmpreaper_protect_extra }}'
TMPREAPER_DIRS='{{ tmpreaper_dirs }}'
TMPREAPER_DELAY='{{ tmpreaper_delay }}'
TMPREAPER_ADDITIONALOPTIONS='{{ tmpreaper_additional_options }}'