olimp/roles/system_cleanup/tasks/main.yml
Administrator b4de236938 Update 4 files
- /group_vars/all.yml
- /roles/system_cleanup/defaults/main.yml
- /roles/system_cleanup/tasks/main.yml
- /olimp-deploy.yml
2025-10-30 07:50:20 +00:00

43 lines
1.2 KiB
YAML

---
- name: Remove unwanted system packages
apt:
name: "{{ cleanup_packages }}"
state: absent
autoremove: "{{ cleanup_autoremove }}"
purge: true
when: cleanup_packages | length > 0
- name: Remove specific SSH authorized keys (if any defined)
authorized_key:
user: root
key: "{{ item }}"
state: absent
loop: "{{ cleanup_ssh_keys | default([]) }}"
when: cleanup_ssh_keys | length > 0
- name: Prune unused Docker containers
command: docker container prune -f
when: cleanup_docker and cleanup_docker_containers
changed_when: true
- name: Prune unused Docker images
command: docker image prune -af
when: cleanup_docker and cleanup_docker_images
changed_when: true
- name: Prune unused Docker volumes
command: docker volume prune -f
when: cleanup_docker and cleanup_docker_volumes
changed_when: true
- name: Prune unused Docker networks
command: docker network prune -f
when: cleanup_docker and cleanup_docker_networks
changed_when: true
- name: Remove custom directories (use with caution!)
file:
path: "{{ item }}"
state: absent
loop: "{{ cleanup_directories | default([]) }}"
when: cleanup_directories | length > 0