Prepare immutable release recovery automation and deployment safeguards

This commit is contained in:
2026-11-26 02:05:13 -05:00
parent 151c59564d
commit 799a377cc0
8 changed files with 773 additions and 0 deletions
@@ -0,0 +1,58 @@
---
- name: Validate recovery inputs without deployment
hosts: localhost
connection: local
gather_facts: false
vars:
v1_release: "{{ lookup('ansible.builtin.file', playbook_dir + '/../recovery/releases/v1.yml') | from_yaml }}"
v2_release: "{{ lookup('ansible.builtin.file', playbook_dir + '/../recovery/releases/v2.yml') | from_yaml }}"
tasks:
- name: Validate immutable release records
ansible.builtin.assert:
that:
- v1_release.release == 'v1'
- v2_release.release == 'v2'
- v1_release.image is match('^.+@sha256:[a-f0-9]{64}$')
- v2_release.image is match('^.+@sha256:[a-f0-9]{64}$')
- v1_release.image != v2_release.image
- v1_release.container_name == v2_release.container_name
- v1_release.host_binding == v2_release.host_binding
- v1_release.expected_pricing.values() | sum == v1_release.expected_total
- v2_release.expected_pricing.values() | sum == v2_release.expected_total
- v1_release.read_only | bool
- v2_release.read_only | bool
- name: Verify external production HTTPS health
ansible.builtin.uri:
url: "{{ v2_release.health_url }}"
return_content: true
timeout: 5
register: health
- name: Verify external production pricing
ansible.builtin.uri:
url: "{{ v2_release.pricing_url }}"
return_content: true
timeout: 5
register: pricing
- name: Validate actual V2 behavior
ansible.builtin.assert:
that:
- health.json.status == 'healthy'
- health.json.version == 'v2'
- pricing.json.version == 'v2'
- pricing.json.plans | length == v2_release.expected_pricing | length
- "dict(pricing.json.plans | map(attribute='name') | zip(pricing.json.plans | map(attribute='price'))) == v2_release.expected_pricing"
- pricing.json.plans | map(attribute='price') | sum == v2_release.expected_total
- name: Report verified release inputs
ansible.builtin.debug:
msg:
- "V1 image: {{ v1_release.image }}"
- "V2 image: {{ v2_release.image }}"
- "Production health: {{ health.json }}"
- "Production pricing: {{ pricing.json }}"
- "SUCCESS: Recovery inputs validated"