mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
The guide job runs the README command in a plain docker-run container where systemd is not PID 1, so stopping apt-daily died with "Service is in unknown state". Extract the neutralize block into tasks/utils/apt/neutralize.yml behind the sd_booted check (/run/systemd/system); ready.yml keeps the container gate on the include and always waits for the dpkg lock. A README documents the gate chain with a mermaid schema. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
---
|
|
- name: "📡 Detect a running systemd (sd_booted convention: /run/systemd/system)"
|
|
ansible.builtin.stat:
|
|
path: /run/systemd/system
|
|
register: apt_neutralize_systemd
|
|
|
|
- name: "🧯 Neutralize apt-daily under a running systemd"
|
|
when: apt_neutralize_systemd.stat.exists
|
|
block:
|
|
- name: "🛑 Stop apt-daily timers"
|
|
ansible.builtin.systemd:
|
|
name: "{{ apt_timer }}"
|
|
state: stopped
|
|
enabled: false
|
|
loop:
|
|
- apt-daily.timer
|
|
- apt-daily-upgrade.timer
|
|
loop_control:
|
|
loop_var: apt_timer
|
|
|
|
- name: "🔪 Stop apt-daily services so no in-flight background apt keeps the dpkg lock"
|
|
ansible.builtin.systemd:
|
|
name: "{{ apt_service }}"
|
|
state: stopped
|
|
loop:
|
|
- apt-daily.service
|
|
- apt-daily-upgrade.service
|
|
loop_control:
|
|
loop_var: apt_service
|
|
|
|
- name: "🚫 Mask apt-daily units to block any background-apt re-trigger"
|
|
ansible.builtin.systemd:
|
|
name: "{{ apt_unit }}"
|
|
masked: true
|
|
loop:
|
|
- apt-daily.timer
|
|
- apt-daily-upgrade.timer
|
|
- apt-daily.service
|
|
- apt-daily-upgrade.service
|
|
loop_control:
|
|
loop_var: apt_unit
|