New to Kestra?
Use blueprints to kickstart your first workflows.
Clone an infrastructure repository with Kestra and execute its Ansible playbook in a containerized working directory against a runtime machine list.
Keep playbooks in Git and let Kestra run them. This blueprint clones your infrastructure repository into a Kestra WorkingDirectory, then executes the committed Ansible playbook against a machine list resolved at runtime. Nothing is copy-pasted into the flow: the repo remains the single source of truth for inventory and playbooks, while Kestra supplies scheduling, credentials, containerized execution, and logs.
getDeployMachinesListFromAPI task (io.kestra.plugin.core.output.OutputValues) stands in for a real CMDB or IPAM lookup and exposes a structured machines list (hostname, IP, owner) that downstream tasks or subflows can iterate over.runAnsible task (io.kestra.plugin.core.flow.WorkingDirectory) creates a shared filesystem for its children, so the clone and the playbook run see the same files.cloneSourceCode (io.kestra.plugin.git.Clone) pulls the main branch of your automation repository, authenticating with GITHUB_USERNAME and GITHUB_ACCESS_TOKEN secrets.ansiblePlaybook (io.kestra.plugin.ansible.cli.AnsibleCLI) runs ansible-playbook -i ansible/inventory.ini ansible/playbook.yml inside the cytopia/ansible:latest-tools container, so workers need no local Ansible installation.ForEach fan-out or subflow dispatch.Running ansible-playbook from a laptop leaves no trace and depends on whoever has the repo checked out. Kestra clones a fresh copy every run, executes in a pinned container image, injects Git credentials from its secret store, and records logs and timings per execution. The WorkingDirectory pattern generalizes: add linting, inventory generation, or post-run verification tasks that all share the same checkout.
ansible/inventory.ini and ansible/playbook.yml (adjust paths to your layout).GITHUB_USERNAME: user or bot account allowed to clone the repository.GITHUB_ACCESS_TOKEN: personal access token used as the clone password.cloneSourceCode at your repository and fix the playbook and inventory paths.io.kestra.plugin.core.trigger.Schedule trigger for recurring configuration runs.io.kestra.plugin.core.http.Request against your CMDB, and render a dynamic inventory from it.io.kestra.plugin.core.flow.ForEach and pass --limit to Ansible.ansible-lint as a gate task before the playbook run.-e extra vars, for example the selected image_names.