Capture current Ansible control plane state
Commit the accumulated infrastructure work that was living only in the working tree: monitoring stack, emergency access/bot, gyro allocator, grimmory, adguard, backup audit and the OpenCode agent definitions. Also ignore Python bytecode, local archives and Nix/direnv artifacts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTocXkGUUazHdKKd3r9k71
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
---
|
||||
- name: Verify Mihomo PBS audit before update
|
||||
hosts: mini-pc
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Read VMID 143 configuration
|
||||
ansible.builtin.command: "pct config 143"
|
||||
register: mihomo_pct_config
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Refuse to run backup unless VMID 143 is Mihomo
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- mihomo_pct_config.rc == 0
|
||||
- mihomo_update_hostname == 'mihomo'
|
||||
fail_msg: VMID 143 must be the Mihomo container before backup.
|
||||
vars:
|
||||
mihomo_update_hostname: >-
|
||||
{{ mihomo_pct_config.stdout_lines
|
||||
| select('match', '^hostname: ')
|
||||
| map('regex_replace', '^hostname: ', '')
|
||||
| first
|
||||
| default('') }}
|
||||
|
||||
- name: Check for active Proxmox backup before Mihomo PBS backup
|
||||
ansible.builtin.command: pgrep -x vzdump
|
||||
register: mihomo_vzdump_preflight
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Require no active Proxmox backup before Mihomo PBS backup
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- mihomo_vzdump_preflight.rc != 0
|
||||
fail_msg: >-
|
||||
A Proxmox backup is already running on mini-pc.
|
||||
Retry after the existing backup completes.
|
||||
|
||||
- name: Create a fresh Mihomo PBS backup
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- vzdump
|
||||
- "143"
|
||||
- --storage
|
||||
- pbs
|
||||
- --mode
|
||||
- snapshot
|
||||
- --prune-backups
|
||||
- keep-all=1
|
||||
- --exclude-path
|
||||
- /var/lib/docker/fuse-overlayfs/*/merged
|
||||
|
||||
- name: Run current PBS backup audit on mini-pc
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- systemctl
|
||||
- start
|
||||
- --wait
|
||||
- homelab-backup-audit-pbs.service
|
||||
changed_when: true
|
||||
|
||||
- import_playbook: pve-mihomo.yml
|
||||
|
||||
- name: Verify Mihomo after update
|
||||
hosts: mihomo
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Wait for Mihomo proxy TCP ports
|
||||
ansible.builtin.wait_for:
|
||||
host: 127.0.0.1
|
||||
port: "{{ item }}"
|
||||
state: started
|
||||
timeout: 120
|
||||
loop:
|
||||
- 7890
|
||||
- 7891
|
||||
- 9090
|
||||
|
||||
- name: Check Mihomo UI endpoint
|
||||
ansible.builtin.uri:
|
||||
url: http://127.0.0.1:8080/
|
||||
status_code: 200
|
||||
register: mihomo_ui_health
|
||||
retries: 24
|
||||
delay: 5
|
||||
until: mihomo_ui_health.status == 200
|
||||
|
||||
- name: Check Mihomo controller /version endpoint
|
||||
ansible.builtin.uri:
|
||||
url: http://127.0.0.1:9090/version
|
||||
status_code: 200
|
||||
register: mihomo_controller_health
|
||||
retries: 24
|
||||
delay: 5
|
||||
until: mihomo_controller_health.status == 200
|
||||
Reference in New Issue
Block a user