diff --git a/defaults/main.yml b/defaults/main.yml index 6093c46..f6ec86f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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' diff --git a/tasks/main.yml b/tasks/main.yml index 4448ed2..4e19195 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,3 +3,4 @@ - import_tasks: locale.yml - import_tasks: timezone.yml - import_tasks: http_client_proxy.yml +- import_tasks: tmpreaper.yml diff --git a/tasks/tmpreaper.yml b/tasks/tmpreaper.yml new file mode 100644 index 0000000..e4775d7 --- /dev/null +++ b/tasks/tmpreaper.yml @@ -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 diff --git a/templates/tmpreaper.conf.j2 b/templates/tmpreaper.conf.j2 new file mode 100644 index 0000000..82569e0 --- /dev/null +++ b/templates/tmpreaper.conf.j2 @@ -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 }}' +