mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-02 15:57:17 +00:00
The pre-flight stopped every deploy on a filesystem above SIZE_PERCENT_MAXIMUM_DISK_USAGE, which blocked a 1.8 TB workstation at 99 % with 30 GB free while a 145 GB runner was fine. A filesystem now fails only when it is above the percentage AND offers less than SIZE_GB_MINIMUM_DISK_FREE (20 GB): disk_usage_errors reads df's available column, the preflight_disk_usage filter passes the floor, and disk.yml runs df -P -k so the block unit stays KiB even under POSIXLY_CORRECT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.1 KiB
YAML
29 lines
1.1 KiB
YAML
---
|
|
- name: "🔍 Read the root directory of the docker daemon"
|
|
ansible.builtin.command:
|
|
argv: [container, info, --format, "{{ '{{json .DockerRootDir}}' }}"]
|
|
register: preflight_docker_root
|
|
changed_when: false
|
|
when: preflight_container_cli.stat.exists
|
|
|
|
- name: "🔍 Measure the usage of / and of the docker root directory"
|
|
ansible.builtin.command:
|
|
argv: "{{ ['df', '-P', '-k', '--'] + preflight_disk_paths }}"
|
|
register: preflight_df
|
|
changed_when: false
|
|
|
|
- name: "🛑 Fail when a filesystem of the deploy is fuller than its limit"
|
|
ansible.builtin.assert:
|
|
that: preflight_disk_errors | length == 0
|
|
quiet: true
|
|
fail_msg: >-
|
|
Pre-flight: {{ preflight_disk_errors | join('; ') }}.
|
|
Loki refuses log pushes above {{ SIZE_PERCENT_MAXIMUM_DISK_USAGE }} % and images fail to pull on a full disk.
|
|
Free space on each listed filesystem (prune unused images and volumes, rotate logs),
|
|
then deploy again.
|
|
vars:
|
|
preflight_disk_errors: >-
|
|
{{ preflight_df.stdout
|
|
| preflight_disk_usage(preflight_disk_paths, SIZE_PERCENT_MAXIMUM_DISK_USAGE,
|
|
SIZE_GB_MINIMUM_DISK_FREE) }}
|