Task Execution Framework
May 8, 2026 ยท View on GitHub
This document explains how to write and run custom playbook projects based on KubeKey. KubeKey's task orchestration follows the conventions of Ansible for easy understanding and quick adoption.
Documentation Navigation
Basic Concepts
| Document | Description |
|---|---|
| Project (001-project) | Project structure, playbooks/roles directories, builtin/local/Git storage methods |
| Playbook (002-playbook) | Playbook definition, hosts/tags/serial, pre_tasks/roles/tasks/post_tasks |
| Role (003-role) | Role structure, defaults/tasks/templates/files, referencing in playbooks |
| Task (004-task) | Task definition, single/multi-layer task, block/rescue/always, loop/register |
Syntax and Variables
| Document | Description |
|---|---|
| Template Syntax (101-syntax) | Go template and Sprig, toYaml/fromYaml, ipInCIDR, custom functions |
| Variables (201-variable) | Static variables (inventory, global config, template params) and dynamic variables (gather_facts, register, set_fact) |
Modules
The modules available in tasks must be registered in the project. The following modules are already registered:
| Module | Description |
|---|---|
| add_hostvars | Inject variables into specified hosts |
| assert | Conditional assertion |
| command | Execute commands (shell/kubectl, etc.) |
| copy | Copy files or directories to target hosts |
| debug | Print variables |
| fetch | Fetch files from remote hosts to local |
| gen_cert | Validate or generate certificates |
| image | Pull/push/copy images |
| include_vars | Load variables from YAML files |
| prometheus | Query Prometheus metrics |
| result | Write to playbook status detail |
| set_fact | Set variables on the current host |
| setup | Gather host information (gather_facts underlying) |
| template | Render templates and copy to target hosts |
Quick Start
- Read Project to understand the directory structure and storage methods.
- Read Playbook and Task to write your first playbook and task.
- Use Template Syntax and Variables to reference and pass parameters.
- Refer to the Module documentation as needed and select the appropriate module for your specific logic.