Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ exclude_paths:
- .github/
- execution_environments/ee_contexts/
- .patch_demo_export/
# Vendored BSOD recovery playbooks/roles (legacy naming; linted CaC is in openshift/setup.yml)
- openshift/windows-bsod-recovery/

mock_modules:
- amazon.aws.aws_caller_info
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**/vault*.yml
sean_login_info.yml
.DS_Store
.idea/
:memory:.ses
choose_demo.yml
choose_demo_example_azure.yml
Expand All @@ -26,4 +27,3 @@ docs/demos/*/index.md

# Leftover export from jopaik/patch_demo clone
.patch_demo_export/

2 changes: 2 additions & 0 deletions openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This category of demos shows examples of OpenShift operations and management wit
|----------|-------------|
| [**CNV — Infra Stack**](docs/openshift-cnv-infra-stack.md) | Workflow to deploy virtualized infrastructure (RHEL 8 + RHEL 9 VMs) in OpenShift Virtualization with inventory sync. |
| [**CNV — Patch Workflow**](docs/openshift-cnv-patch-workflow.md) | Snapshot CNV virtual machines, apply patches, and automatically restore from snapshot on failure. |
| [**Windows — BSOD Recovery**](docs/openshift-windows-bsod-recovery.md) | Simulate and recover from a Windows Blue Screen of Death on OpenShift Virtualization. |
| [**Windows — Generate WinPE Image**](docs/openshift-windows-bsod-recovery.md) | Build and upload a WinPE recovery ISO to OpenShift Virtualization. |

### Jobs

Expand Down
113 changes: 113 additions & 0 deletions openshift/docs/openshift-windows-bsod-recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Windows — BSOD Recovery

Automated Blue Screen of Death recovery for Windows Server VMs running on OpenShift Virtualization. Inspired by the [2024 CrowdStrike incident](https://en.wikipedia.org/wiki/2024_CrowdStrike_incident), this demo shows how Ansible Automation Platform can recover Windows systems from critical boot failures at scale using a custom WinPE recovery environment.

## Prerequisites

- OpenShift cluster with **CNV operator installed** (run **OpenShift | CNV | Install Operator** first)
- A **Windows Server OS image** populated in OpenShift Virtualization (e.g. `windows-2022-standard` template)
- **OpenShift Credential** configured with API bearer token
- **APD Machine Credential** configured with Windows administrator credentials
- OCS/ODF storage class available (`ocs-external-storagecluster-ceph-rbd`)

## Workflows

This demo includes three workflows:

### BSOD Recovery (main demo)

The primary workflow that provisions Windows VMs, triggers a simulated BSOD, recovers via WinPE, and verifies the fix.

```
Provision Infrastructure ──→ Inventory Sync ──→ Produce BSOD
│
Recover from BSOD
│
Inventory Sync 2
│
Check System
```

1. **Provision Infrastructure** — Deploys Windows Server VMs on OpenShift Virtualization
2. **Inventory Sync** — Refreshes **OpenShift Windows CNV Inventory** to discover the new VMs
3. **Produce BSOD** — Triggers a simulated Blue Screen of Death on the Windows VMs
4. **Recover from BSOD** — Boots the affected VM into a custom WinPE environment and applies the recovery fix
5. **Inventory Sync 2** — Re-syncs **OpenShift Windows CNV Inventory** after the VM reboots with the fix applied
6. **Check System** — Verifies the Windows system is healthy and operational

### Generate WinPE Image (prerequisite)

Run this workflow first to build the WinPE recovery ISO that the BSOD Recovery workflow uses.

```
Provision Infrastructure ──→ Inventory Sync ──→ Generate WinPE ──→ Upload WinPE ISO ──→ Remove Infrastructure
```

1. **Provision Infrastructure** — Deploys a Windows Server VM to use as a WinPE build host
2. **Inventory Sync** — Discovers the new VM in **OpenShift Windows CNV Inventory**
3. **Generate WinPE** — Creates a custom WinPE ISO with embedded recovery scripts
4. **Upload WinPE ISO** — Uploads the ISO to OpenShift Virtualization as a PVC
5. **Remove Infrastructure** — Cleans up the build VM (no longer needed)

### Clean up BSOD VMs

Removes all Windows VMs created by the BSOD Recovery workflow.

## Job templates

| Template | Playbook | Description |
|----------|----------|-------------|
| OpenShift ǀ Windows ǀ Provision Infrastructure | `provision_infra_multi.yml` | Provisions Windows Server VMs on OpenShift Virtualization |
| OpenShift ǀ Windows ǀ Remove Infrastructure | `remove_infra_multi.yml` | Removes provisioned Windows VMs |
| OpenShift ǀ Windows ǀ Generate WinPE | `generate_winpe.yml` | Creates a custom WinPE recovery ISO |
| OpenShift ǀ Windows ǀ Upload WinPE ISO | `upload_winpe_iso.yml` | Uploads the WinPE ISO to OpenShift Virtualization |
| OpenShift ǀ Windows ǀ Produce BSOD | `produce_bsod.yml` | Triggers a simulated BSOD on Windows VMs |
| OpenShift ǀ Windows ǀ Recover from BSOD | `execute_winpe_recovery.yml` | Boots into WinPE and applies the recovery fix |
| OpenShift ǀ Windows ǀ Check System | `check_system.yml` | Verifies the system is healthy after recovery |

## How it works

The recovery process uses a **Windows Preinstallation Environment (WinPE)** — a lightweight Windows boot image that can run recovery scripts without needing the OS to be operational. The workflow:

1. **Generates a custom WinPE ISO** with embedded recovery scripts tailored to the specific failure scenario (e.g. removing a faulty driver file like the CrowdStrike `csagent.sys`)
2. **Boots the affected VM from the WinPE ISO** using OpenShift Virtualization's ability to attach ISO images to VMs
3. **Executes the recovery script** inside WinPE, which mounts the Windows partition and applies the fix
4. **Reboots the VM** back to the repaired Windows installation

This approach works because WinPE can access the Windows filesystem even when Windows itself cannot boot — exactly the scenario during a BSOD.

## Why it matters

- Demonstrates **automated disaster recovery** at scale — manually fixing BSOD on thousands of machines is not feasible
- The 2024 CrowdStrike incident affected ~8.5 million Windows devices — this demo shows how AAP could have automated the fix
- Separating WinPE generation from recovery execution means the same framework handles different BSOD root causes
- Shows AAP managing **Windows workloads on OpenShift** — a powerful cross-platform story

## Presenter walkthrough

1. **Set the stage:** Reference the 2024 CrowdStrike incident — a faulty update bricked millions of Windows machines. IT teams had to manually boot each machine into Safe Mode and delete a file. "What if we could automate that?"
2. **Show the WinPE generation:** If not already done, run the Generate WinPE Image workflow. Explain how the recovery logic is embedded in the ISO.
3. **Launch the BSOD Recovery workflow:** Show the audience the Windows VM running normally, then launch the workflow. The "Produce BSOD" step intentionally crashes the VM.
4. **The blue screen:** Show the VM console — it's stuck on a BSOD. "In the real world, this is where someone walks to the data center."
5. **Automated recovery:** Point out the "Recover from BSOD" step — AAP attaches the WinPE ISO, boots from it, runs the fix script, and reboots. No manual intervention.
6. **Verification:** The "Check System" step confirms Windows is back and healthy. "From crash to recovery, fully automated."
7. **Clean up:** Run the cleanup workflow to remove the demo VMs.

## Talking points

- This is a real-world scenario, not a contrived demo — the CrowdStrike incident made headlines worldwide
- The same WinPE-based approach works for any boot-level Windows issue, not just CrowdStrike
- OpenShift Virtualization provides the VM management APIs that make programmatic ISO attachment possible
- AAP workflows handle the orchestration — provisioning, crashing, recovering, verifying — in a single automation

## Related demos

| Demo | Description |
|------|-------------|
| ⎈ [CNV — Install Operator](./openshift-cnv-install.md) | Required prerequisite — installs the CNV operator |
| ⎈ [CNV — Infra Stack](./openshift-cnv-infra-stack.md) | Deploy RHEL VMs on CNV (similar infrastructure provisioning pattern) |
| ⎈ [CNV — Patch Workflow](./openshift-cnv-patch-workflow.md) | Patching workflow for CNV VMs with snapshot/restore |

## Credits

Demo created by [Orcun Atakan](https://github.com/oatakan). The source playbooks and roles are included in `openshift/windows-bsod-recovery/`.
29 changes: 29 additions & 0 deletions openshift/inventory.windows.kubevirt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
plugin: redhat.openshift_virtualization.kubevirt
strict: false
connections:
- namespaces:
- openshift-cnv
compose:
ansible_user: "'cloud-user' if 'rhel' in vmi_annotations['vm.kubevirt.io/os'] else 'admin'"
vmi_annotations: "vmi_annotations | ansible.utils.replace_keys(target=[
{'before':'vm.kubevirt.io/os', 'after':'os'},
{'before':'vm.kubevirt.io/flavor', 'after':'flavor'},
{'before':'vm.kubevirt.io/workload', 'after':'workload'},
{'before':'kubevirt.io/vm-generation', 'after':'vm-generation'},
{'before':'kubevirt.io/latest-observed-api-version', 'after':'latest-observed-api-version'},
{'before':'kubevirt.io/storage-observed-api-version', 'after':'storage-observed-api-version' }] )"
labels: "vmi_labels | ansible.utils.replace_keys(target=[
{'before':'kubevirt.io/nodeName', 'after':'nodeName'},
{'before':'kubevirt.io/size', 'after':'size'},
{'before':'kubevirt.io/domain', 'after':'domain' }] )"
keyed_groups:
- key: vmi_annotations.os
prefix: "cnv"
separator: "_"
- key: vmi_labels.app_name
prefix: "label_app_name"
separator: "_"
- key: vmi_labels.role
prefix: "label_role"
separator: "_"
Loading
Loading