New to Kestra?
Use blueprints to kickstart your first workflows.
Select a VM from the Kestra Assets catalog and run an Ansible playbook that creates a sudo user and installs their SSH key, with full asset lineage.
Grant server access as a workflow instead of a favor. An operator picks a VM from a dropdown backed by the Kestra Assets catalog, enters the new user's login and SSH public key, and an Ansible playbook connects to the machine, creates the account with sudo membership, and installs the authorized key. The execution is linked to the VM asset, so every machine carries a history of who was onboarded onto it and when.
vmAssetId input uses a dynamic expression with the assets() function to list all io.kestra.plugin.ee.assets.VM assets, restricting onboarding to machines Kestra actually manages.vmMetadata task (io.kestra.plugin.core.output.OutputValues) fetches the selected asset's metadata, including its vmName.run_ansible task (io.kestra.plugin.ansible.cli.AnsibleCLI) builds everything inline: the SSH private key is written from a secret to id_rsa, and the inventory resolves the VM's external IP by looking up kv('externalIpAddressMapping')[vmName], a KV map maintained by your provisioning flow.become: true: user creates the account with groups: sudo, shell: /bin/bash, and a home directory, and authorized_key installs the provided public key. The assets.inputs block records the VM as lineage input.chmod 600 id_rsa satisfies SSH key permission requirements before ansible-playbook -i inventory.ini playbook.yml runs.Manually adding users means someone with root SSHes in, runs useradd, and pastes a key, with no record and no consistency. Here the target list is constrained to cataloged assets, the IP resolution is automatic via the KV store, the playbook is versioned with the flow, credentials come from the secret backend, and the audit trail is the execution history itself. Add a Pause task and manager approval becomes part of the same flow.
externalIpAddressMapping mapping VM names to reachable IPs.SSH_PRIVATE_KEY: root private key used by Ansible to reach the target VM.externalIpAddressMapping exists in the KV store with your VM name to IP mapping.ssh <username>@<vm-ip> with the matching private key.io.kestra.plugin.core.flow.Pause approval gate before the playbook for privileged access requests.state: absent on the user and removes the key.io.kestra.plugin.email.MailSend once access is granted.sudo.