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,98 @@
|
||||
---
|
||||
- name: Create and verify Vaultwarden backup before update
|
||||
hosts: vaultwarden
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Create a fresh Vaultwarden offsite backup
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- systemctl
|
||||
- start
|
||||
- --wait
|
||||
- homelab-restic-offsite-vaultwarden.service
|
||||
changed_when: true
|
||||
|
||||
- name: Run Vaultwarden offsite backup audit
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- systemctl
|
||||
- start
|
||||
- --wait
|
||||
- homelab-backup-audit-vaultwarden.service
|
||||
changed_when: true
|
||||
|
||||
- name: Create and verify Vaultwarden PBS backup before update
|
||||
hosts: mini-pc
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Read existing VMID 140 configuration
|
||||
ansible.builtin.command: pct config 140
|
||||
register: vaultwarden_existing_vmid
|
||||
changed_when: false
|
||||
|
||||
- name: Refuse to modify a foreign VMID 140
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- vaultwarden_existing_vmid.rc == 0
|
||||
- vaultwarden_existing_hostname == 'vaultwarden'
|
||||
fail_msg: VMID 140 already exists and is not the Vaultwarden container.
|
||||
vars:
|
||||
vaultwarden_existing_hostname: >-
|
||||
{{ vaultwarden_existing_vmid.stdout_lines
|
||||
| select('match', '^hostname: ')
|
||||
| map('regex_replace', '^hostname: ', '')
|
||||
| first
|
||||
| default('') }}
|
||||
|
||||
- name: Check for active Proxmox backup before Vaultwarden PBS backup
|
||||
ansible.builtin.command: pgrep -x vzdump
|
||||
register: vaultwarden_vzdump_preflight
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Require no active Proxmox backup before Vaultwarden PBS backup
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- vaultwarden_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 Vaultwarden PBS backup
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- vzdump
|
||||
- "140"
|
||||
- --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-vaultwarden.yml
|
||||
|
||||
- name: Verify Vaultwarden public endpoint after update
|
||||
hosts: ru-vps
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Check Vaultwarden HTTPS endpoint
|
||||
ansible.builtin.uri:
|
||||
url: https://pass.ada-dev.ru/
|
||||
status_code: 200
|
||||
return_content: false
|
||||
register: vaultwarden_public_health
|
||||
retries: 24
|
||||
delay: 5
|
||||
until: vaultwarden_public_health.status == 200
|
||||
Reference in New Issue
Block a user