Install and configure tmpreaper if required, on Debian/Ubuntu.

This commit is contained in:
Andrea Dell'Amico 2019-12-11 11:57:55 +01:00
parent a6bbd67e1c
commit 63ca3a71a8
4 changed files with 43 additions and 0 deletions

View File

@ -2,6 +2,7 @@
dependencies:
- role: '../../library/roles/ubuntu-deb-general'
- { role: '../../library/roles/cloud-init', when: ansible_product_name == "oVirt Node" }
- role: '../../library/roles/tmpreaper'
- role: '../../library/roles/iptables'
- { role: '../../library/roles/data_disk', when: additional_disks is defined and additional_disks }
- role: '../../library/roles/sshd_config'

View File

@ -0,0 +1,8 @@
---
tmpreaper_install: False
tmpreaper_protect_extra: ''
tmpreaper_dirs: '/tmp/.'
tmpreaper_delay: '256'
tmpreaper_additional_options: ''
tmpreaper_time: '7d'

View File

@ -0,0 +1,27 @@
---
- 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 | bool
- 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 | bool
- 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 }}'