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

DocumentDescription
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

DocumentDescription
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:

ModuleDescription
add_hostvarsInject variables into specified hosts
assertConditional assertion
commandExecute commands (shell/kubectl, etc.)
copyCopy files or directories to target hosts
debugPrint variables
fetchFetch files from remote hosts to local
gen_certValidate or generate certificates
imagePull/push/copy images
include_varsLoad variables from YAML files
prometheusQuery Prometheus metrics
resultWrite to playbook status detail
set_factSet variables on the current host
setupGather host information (gather_facts underlying)
templateRender templates and copy to target hosts

Quick Start

  1. Read Project to understand the directory structure and storage methods.
  2. Read Playbook and Task to write your first playbook and task.
  3. Use Template Syntax and Variables to reference and pass parameters.
  4. Refer to the Module documentation as needed and select the appropriate module for your specific logic.