Files
computer-playbook/tasks/utils/apt/neutralize.yml
kevinveenbirkenbachandClaude Opus 4.8 65240096cf fix(bootstrap): gate apt-daily neutralize on a running systemd
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>
2026-07-18 19:53:20 +02:00

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