---
- 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