Files
PhilandClaude Opus 5.5 3036fa2d74 Mac: Podman VM job needs AbandonProcessGroup
`podman machine start` exits once the VM is up, and launchd then killed the
VM processes left in the job's process group, so a VM started by the job
stopped ~20 s later. Keep them with AbandonProcessGroup, and reload the job
when its plist changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 07:29:08 -07:00

55 lines
1.9 KiB
YAML

# The Podman VM runs Hermes's sandbox containers. A launchd job starts it at
# login, and starts it again after a resize.
- name: Podman VM launchd job
ansible.builtin.template:
src: podman-machine.plist.j2
dest: "{{ ansible_user_dir }}/Library/LaunchAgents/{{ podman_machine_label }}.plist"
mode: "0644"
register: podman_plist
- name: Unload the old Podman VM job definition
ansible.builtin.command:
argv: [launchctl, bootout, "gui/{{ ansible_user_uid }}/{{ podman_machine_label }}"]
when: podman_plist is changed
failed_when: false
- name: Check the Podman VM job is loaded
ansible.builtin.command:
argv: [launchctl, print, "gui/{{ ansible_user_uid }}/{{ podman_machine_label }}"]
register: podman_job
changed_when: false
failed_when: false
check_mode: false
- name: Load the Podman VM job
ansible.builtin.command:
argv: [launchctl, bootstrap, "gui/{{ ansible_user_uid }}",
"{{ ansible_user_dir }}/Library/LaunchAgents/{{ podman_machine_label }}.plist"]
when: podman_job.rc != 0
- name: Read Podman VM memory
ansible.builtin.command:
argv: [/opt/podman/bin/podman, machine, inspect, --format, !unsafe "{{.Resources.Memory}}"]
register: podman_memory
changed_when: false
check_mode: false
# Stopping ends any sandbox containers that are running.
- name: Resize the Podman VM
ansible.builtin.shell: |
set -e
/opt/podman/bin/podman machine stop
/opt/podman/bin/podman machine set --memory {{ podman_machine_memory }}
launchctl kickstart gui/{{ ansible_user_uid }}/{{ podman_machine_label }}
when: podman_memory.stdout | int != podman_machine_memory
- name: Podman VM is running
ansible.builtin.command:
argv: [/opt/podman/bin/podman, machine, inspect, --format, !unsafe "{{.State}}"]
register: podman_state
until: podman_state.stdout == "running"
retries: 12
delay: 5
changed_when: false
check_mode: false