[common] feat: added apt cleanup job

This commit is contained in:
Simon Cornet 2024-12-17 16:36:51 +01:00
commit 39aaf8e076
2 changed files with 24 additions and 0 deletions

17
tasks/apt/cleanup.yaml Normal file
View file

@ -0,0 +1,17 @@
---
# clean apt cache
- name: "apt - clean cache"
ansible.builtin.apt:
clean: true
when: 'ansible_os_family == "Debian"'
tags: 'apt-cleanup'
# run fstrim if target is a VM
- name: "fstrim"
ansible.builtin.command: "fstrim /"
changed_when: false
failed_when: false
tags: 'apt-cleanup'
when:
- 'type = "vm"'

View file

@ -5,6 +5,7 @@
ansible.builtin.import_tasks: "ossupport.yaml" ansible.builtin.import_tasks: "ossupport.yaml"
tags: tags:
- "apt" - "apt"
- "apt-cleanup"
- "cron" - "cron"
- "environment-file" - "environment-file"
- "hostname" - "hostname"
@ -31,6 +32,7 @@
when: "os_support" when: "os_support"
tags: tags:
- "apt" - "apt"
- "apt-cleanup"
- "cron" - "cron"
- "environment-file" - "environment-file"
- "hostname" - "hostname"
@ -124,6 +126,11 @@
when: "os_support" when: "os_support"
tags: "apt" tags: "apt"
- name: "apt - cleanup"
ansible.builtin.import_tasks: "apt/cleanup.yaml"
when: "os_support"
tags: "apt-cleanup"
# telemetry # telemetry
- name: "telemetry" - name: "telemetry"
ansible.builtin.import_tasks: "telemetry.yaml" ansible.builtin.import_tasks: "telemetry.yaml"