New to Kestra?
Use blueprints to kickstart your first workflows.
Apply apt patches to VMs over SSH with Kestra. A human validates the patch, and failures or rejections trigger automatic rollback to the prior version.
Patching without a rollback plan is gambling. This blueprint applies a specific package upgrade to a VM over SSH, notifies the team, and pauses so a human can validate the patched system. If the install fails, or the validator rejects it, the flow parses the previous version out of the patch identifier and reinstalls it automatically. Structured outputs (actionPerformed, actionState, stateReason) make the flow composable: a parent orchestrator can patch UAT first and only proceed to production when this flow reports a validated success.
takeSnapshot task is a placeholder for your hypervisor or cloud snapshot call, the coarse-grained safety net before any change.patchVM task (io.kestra.plugin.fs.ssh.Command) runs apt update and installs the package parsed from patchId with the Pebble expression {{ (inputs.patchId | split('/'))[0] }}.checkSuccess (io.kestra.plugin.core.flow.If) notifies Slack and the waitForApproval task (io.kestra.plugin.core.flow.Pause) suspends the run with onResume inputs approvePatch (BOOL) and reason (STRING).rollBackIfRequired If triggers when the install failed or approval was denied; rollBackVM reinstalls the previous version extracted from the patch string: apt install -y pkg={{ ((inputs.patchId | split('from: '))[1] | split(']'))[0] }}.patchState and rollBackState (io.kestra.plugin.core.output.OutputValues) normalize the result, and the flow outputs expose the final action, state, and reason for parent flows.A patching script cannot wait a day for someone to validate the application, and it forgets the previous version the moment it upgrades. Kestra's Pause with onResume inputs captures the human verdict and reason durably, expressions parse rollback targets from the patch metadata, conditional branches make rollback deterministic rather than a manual scramble, and flow outputs let a parent orchestrate multi-stage rollouts.
SSH_VM_USER: SSH username for the target VM.SSH_VM_PASSWORD: password for the SSH account (or switch to authMethod: PUBLIC_KEY with a private key secret).SLACK_WEBHOOK_URL: Slack incoming webhook for approval notifications.apt list --upgradable on the target to pick a real patchId string.approvePatch: true or false.PATCH or ROLLBACK and the recorded reason.curl a health endpoint, systemctl is-active) before requesting approval.PUBLIC_KEY auth and pull the patch list dynamically from the KV store.