fix(pacman-cache): empty the pacman package cache before the edge image pulls #1580
@@ -34,6 +34,7 @@
|
||||
roles:
|
||||
- certificates
|
||||
- common
|
||||
- pacman-cache
|
||||
- edge-flash-wear
|
||||
- docker-install
|
||||
- edge-log-shipper
|
||||
|
||||
@@ -25,34 +25,6 @@
|
||||
check_mode: false
|
||||
when: os_update_docker.stat.exists
|
||||
|
||||
# pacman keeps every downloaded package; on the edge hosts' 7 GB eMMC root
|
||||
# the cache grows to gigabytes.
|
||||
- name: Ensure the pacman hook directory exists (Arch)
|
||||
ansible.builtin.file:
|
||||
path: /etc/pacman.d/hooks
|
||||
state: directory
|
||||
mode: "0755"
|
||||
when: ansible_facts['os_family'] == 'Archlinux'
|
||||
|
||||
- name: Empty the package cache after every transaction (Arch)
|
||||
ansible.builtin.copy:
|
||||
src: pacman-cache.hook
|
||||
dest: /etc/pacman.d/hooks/pacman-cache.hook
|
||||
mode: "0644"
|
||||
when: ansible_facts['os_family'] == 'Archlinux'
|
||||
|
||||
- name: Empty the package cache (Arch)
|
||||
ansible.builtin.command:
|
||||
argv: [find, /var/cache/pacman/pkg, -mindepth, "1", -delete, -print]
|
||||
register: os_update_pacman_cache
|
||||
changed_when: os_update_pacman_cache.stdout | length > 0
|
||||
when: ansible_facts['os_family'] == 'Archlinux'
|
||||
|
||||
- name: Re-read mounts after the cache cleanup
|
||||
ansible.builtin.setup:
|
||||
gather_subset: [mounts]
|
||||
when: os_update_pacman_cache is changed
|
||||
|
||||
- name: Assert at least 1 GiB free on /
|
||||
ansible.builtin.assert:
|
||||
that: >-
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Managed by ansible (roles/os-update).
|
||||
# Managed by ansible (roles/pacman-cache).
|
||||
# Downloaded packages are not kept; older versions come from the Arch Linux
|
||||
# Archive.
|
||||
[Trigger]
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# Keep the pacman package cache empty. pacman keeps every downloaded package;
|
||||
# on a 7 GB eMMC root the cache grows to gigabytes. Arch hosts only.
|
||||
|
||||
- name: Ensure the pacman hook directory exists
|
||||
ansible.builtin.file:
|
||||
path: /etc/pacman.d/hooks
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Empty the package cache after every transaction
|
||||
ansible.builtin.copy:
|
||||
src: pacman-cache.hook
|
||||
dest: /etc/pacman.d/hooks/pacman-cache.hook
|
||||
mode: "0644"
|
||||
|
||||
- name: Empty the package cache
|
||||
ansible.builtin.command:
|
||||
argv: [find, /var/cache/pacman/pkg, -mindepth, "1", -delete, -print]
|
||||
register: pacman_cache_clean
|
||||
changed_when: pacman_cache_clean.stdout | length > 0
|
||||
Reference in New Issue
Block a user