New to Kestra?
Use blueprints to kickstart your first workflows.
Query Kestra asset metadata to find servers running outdated Python, upgrade each machine, update its asset record, export the catalog, and analyze failures with AI.
Fleet upgrades fail when target selection relies on stale spreadsheets. This blueprint selects its targets from live data: it queries the Kestra asset catalog for io.kestra.plugin.ee.assets.VM assets in a chosen environment whose python_version metadata differs from the desired version, upgrades each machine, and writes the new version back into the asset record in the same task. A JSON export ships the refreshed catalog to external systems, and an error branch feeds failures to a Gemini-powered AI agent for root cause analysis.
target_version (default 3.11) and the env to upgrade (staging or prod).query_assets (io.kestra.plugin.core.debug.Return) calls assets(metadata={"env": inputs.env, "os": "Debian"}) and filters with jq to keep only servers whose metadata.python_version differs from the target. Selection is pure metadata, no hardcoded host lists.run_upgrades (io.kestra.plugin.core.flow.ForEach) iterates over the matches. get_server_details (io.kestra.plugin.core.execution.SetVariables) unpacks id, IP, and current version.ssh_python_update (io.kestra.plugin.scripts.shell.Commands) simulates the upgrade over SSH. Crucially, its assets block declares the server as input and re-registers it as output with python_version set to the target, so the catalog reflects reality the moment the upgrade lands.export_assets_to_file (io.kestra.plugin.ee.assets.AssetShipper with io.kestra.plugin.ee.assets.FileAssetExporter) exports the catalog as JSON for CMDBs or reporting.errors branch runs analyze_error (io.kestra.plugin.ai.agent.AIAgent with io.kestra.plugin.ai.provider.GoogleGemini), feeding {{ errorLogs() }} to Gemini 3.5 Flash Lite and logging the diagnosis.Configuration management tools can push a new Python, but they cannot select targets from a governed asset catalog, update that catalog transactionally with the change, or explain their own failures. Kestra combines the assets() query function, per-server ForEach task runs with isolated logs, first-class error branches, and an AI agent task in one declarative file, with schedules and webhooks to run it hands-free.
env, os, python_version, and ip_address metadata, for example registered by the asset-provision-servers blueprint.UPGRADE_WEBHOOK_KEY: shared secret guarding the Webhook trigger.GEMINI_API_KEY: Google Gemini API key used by the AIAgent error task.asset-provision-servers first so VM assets with metadata exist.io.kestra.plugin.fs.ssh.Command or an Ansible playbook for real upgrades.every_sunday_morning schedule for a weekly patch window.FileAssetExporter for the OpenLineage exporter to feed a lineage backend.Pause approval before touching prod, gated on the env input with a Switch task.