New to Kestra?
Use blueprints to kickstart your first workflows.
Audit all VM assets for a required security agent, record compliance status as asset metadata, then automatically reinstall the agent on non-compliant servers.
Security audits that end in a PDF do not fix anything. This blueprint runs a closed audit-remediate loop over your whole fleet: it enumerates every io.kestra.plugin.ee.assets.VM asset in the Kestra catalog, checks each machine for a required endpoint security agent, stamps compliance_status and last_audit into the asset metadata, then immediately queries for the non-compliant machines and reinstalls the agent on them, resetting their status to compliant. The asset catalog is both the target list and the compliance record.
get_all_servers (io.kestra.plugin.core.debug.Return) fetches every VM asset with assets(type='io.kestra.plugin.ee.assets.VM').audit_servers (io.kestra.plugin.core.flow.ForEach) loops over the fleet. get_server_info (io.kestra.plugin.core.execution.SetVariables) unpacks id, IP, env, OS, and Python version from each asset.check_security_agent (io.kestra.plugin.scripts.shell.Script) simulates the probe, reporting the agent missing on srv-stg-01. Replace it with a real SSH check or an EDR API call.update_compliance_status (io.kestra.plugin.core.debug.Return) re-registers each VM asset with compliance_status (via a ternary expression), last_audit: {{ now() }}, and the carried-over inventory metadata.fleet_remediation (io.kestra.plugin.core.flow.Sequential) closes the loop: find_non_compliant queries assets(metadata={'compliance_status': 'non-compliant'}), then install_security_agent iterates over the offenders and ssh_install (io.kestra.plugin.scripts.shell.Commands) reinstalls the agent, resetting compliance_status: compliant and stamping remediated_at.Schedule trigger (disabled by default) and a webhook secured by AUDIT_WEBHOOK_KEY provide automation entry points.remediated_at evidence.Scanners find gaps; ticket queues let them age. Kestra collapses detection and remediation into one governed workflow: the assets() function supplies live fleet state, ForEach gives per-machine isolation and retries, and asset metadata becomes an auditable compliance ledger updated transactionally with each fix. Schedules make it continuous and the execution history proves every audit and every remediation, including who or what triggered them.
ip_address, env, os, and python_version metadata, for example registered by the asset-provision-servers blueprint.AUDIT_WEBHOOK_KEY: shared secret guarding the Webhook trigger, for example called by GitHub Actions.AUDIT_WEBHOOK_KEY secret to your Kestra instance.asset-provision-servers so VM assets exist in the catalog.daily_audit schedule to make the audit continuous.io.kestra.plugin.fs.ssh.Command or your EDR vendor's API.Pause approval before remediation in production environments.