rollback-and-runbooks
Skill0 starsChanged 5 months agoMITView on GitHub
The single authority for reverting a change and for operational runbooks. Covers the forward-fix vs roll-back decision, GitLab re-deploy-previous-artifact, Octopus re-deploy-release and Config-as-Code runbooks, database-migration backward-safety, and dual-control break-glass. Triggers on: rollback, roll back, revert deploy, runbook, restart, DR, disaster recovery, break-glass, redeploy previous, backout.
In this repository24 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ansible-patternsSkill
- ansible-testingSkill
- change-documentationSkill
- ci-pipeline-debuggingSkill
- drift-detectionSkill
- gitlab-cicd-pipelineSkill
- hsa-infrastructureSkill
- iac-sast-scanningSkill
- iac-tooling-selectionSkill
- incident-responseSkill
- instinct-promotionSkill
- instinct-rollbackSkill
- knowledge-curationSkill
- multi-env-promotionSkill
- octopus-releaseSkill
- pci-cp-complianceSkill
- pci-dss-complianceSkill
- pci-pin-awarenessSkill
- perso-change-controlSkill
- perso-complianceSkill
- pre-commit-and-secret-scanningSkill
- secrets-vaultSkill
- supply-chain-and-sbomSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use when planning or executing a revert of a deployed change, or when authoring an
- Very specific: line 45
Ansible: prefer a tagged revert play validated with --check --diff before any apply.
- Distinctive: line 85
No autonomous prod apply, no auto-promote, no break-glass execution by the agent.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rollback & Runbooks Skill
When to Use
Use when planning or executing a revert of a deployed change, or when authoring an operational runbook (restart, rotate, DR, break-glass). This is the single source for rollback reasoning so it does not get reinvented inconsistently across plans, authoring, and promotion. Execution is always human-gated (propose-never-dispose); this skill produces the procedure and the decision, not an autonomous prod action.
How It Works
Forward-fix vs. roll-back — decide first
| Choose roll back when… | Choose forward-fix when… |
| the change is isolated and the previous artifact is known-good | the change includes a non-reversible step (e.g. a destructive DB migration) |
| impact is active and you need the fastest safe restore | rolling back would itself cause data loss or schema mismatch |
| no schema/data migration is entangled | the defect is small and a corrected roll-forward is safer than reverting |
Database migrations are the trap: a backward migration is not always safe. If a migration dropped/transformed data, rolling back the artifact without a tested down- migration corrupts state. Default to forward-fix for entangled migrations; only roll a migration back with a verified, tested down-path.
Rollback mechanics (build-once, promote-one-artifact)
- GitLab: redeploy the previous immutable artifact (same checksum/attestation),
not a rebuild. Use the environment's last-good deployment or a manual job that
re-runs the prior artifact. Never
git revert+ rebuild for a hot restore. - Octopus: re-deploy the previous release to the environment (Octopus keeps the exact prior package), gated by the lifecycle's manual-intervention step. Operational actions (restart/rotate/DR) belong in Octopus runbooks, not the deploy process.
- Ansible: prefer a tagged revert play validated with
--check --diffbefore any apply; the apply is human-run, never by the agent.
Runbooks (first-class, audited)
Author operational runbooks as version-controlled, RBAC-gated, audited procedures (Octopus Config-as-Code runbooks where available). Each runbook states: trigger, preconditions, exact steps, verification, rollback-of-the-runbook, and who may run it.
Break-glass (emergency)
A break-glass procedure is dual-control, time-boxed, and fully logged: two distinct authorized humans, an expiry, every action to the governance ledger/SIEM, and a mandatory post-incident review. The agent may draft and document it; it never executes it.
Examples
Rollback decision record (attach to the MR / change record)
Decision: ROLL BACK | FORWARD FIX
Reason: <isolated change, prior artifact known-good> / <migration not safely reversible>
Mechanism: GitLab redeploy artifact <sha> | Octopus re-deploy release <n> | tagged revert play
Verification: <command/observation that confirms restore>
Approval: <human gate — who approves the apply>Octopus re-deploy of the previous release (human-gated)
1. Octopus → Project → Releases → select last known-good release
2. Deploy to <env> → triggers the lifecycle manual-intervention gate
3. A human approves the intervention; the prior package is redeployed unchanged
4. Verify health checks + a post-deploy --check --diff shows no driftTrust boundary
- The agent proposes rollbacks/runbooks; humans/pipelines execute them.
- No autonomous prod apply, no auto-promote, no break-glass execution by the agent.
- Rollbacks touching the HSA are out of scope here — route to the in-zone lane.
Deep Reference
Rollback Decision Matrix
| Scenario | Preferred action | Rationale |
| Single task failed, state is known | Fix-forward: patch the task, re-run | Faster than full rollback |
| Multiple tasks failed, state is uncertain | Full rollback | Predictable outcome |
| Schema/data migration changed | Forward-only with compensating migration | Rollback may corrupt data |
| Dependency version changed | Rollback to previous artifact | Pin and redeploy known-good |
| Security vulnerability in released version | Forward-only emergency patch | Documented emergency change process |
Standard Rollback Playbook Pattern
# rollback.yml — always ship alongside site.yml
- hosts: "{{ target_hosts | default('all') }}"
vars:
rollback_version: "{{ previous_version }}"
tasks:
- name: Stop service
ansible.builtin.systemd:
name: "{{ service_name }}"
state: stopped
- name: Restore previous package
ansible.builtin.copy:
src: "{{ artifact_store }}/{{ service_name }}-{{ rollback_version }}.pkg"
dest: /opt/{{ service_name }}/current.pkg
mode: '0644'
tags: [rollback]
- name: Start service
ansible.builtin.systemd:
name: "{{ service_name }}"
state: started
- name: Verify rollback succeeded
ansible.builtin.uri:
url: "http://localhost:{{ service_port }}/healthz"
status_code: 200
retries: 5
delay: 3Break-Glass Procedure
Document in knowledge/runbooks/break-glass.md:
- Who can authorize break-glass (named roles, not individuals)
- What actions are permitted without the standard change process
- Maximum window duration
- Mandatory post-action change record within 24h
- Governance ledger entry required
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

