Playbook Structure
The full field reference for the top level, the inventory, plays, role directories and task fields.
FleetKite supports playbooks in YAML and JSON, and offers three top-level shapes:
- The standard multi-play playbook (recommended): a top-level mapping with
servers/inventory,global,varsandplays[]. - The flat single-stage form:
roles,tasksandhandlerswritten at the top level (withplaysomitted); the engine assembles them into one play namedDefault Playtargetingall. - A bare list of plays: a top-level YAML list of
- name: ... / hosts: ... / tasks: ...entries (used with an inventory, a default target, orconnection: local).
Top-level fields
| Field | Type | Default | Description |
|---|---|---|---|
concurrency | integer | 5 | The upper bound on hosts running at the same time inside a batch; a value <= 0 falls back to 5. The CLI's --concurrency overrides it |
gather_facts | boolean | true | Only used by the flat form (no plays), passed through to the generated Default Play |
global | object | {} | Global defaults for connections, SSH security, escalation, logging, transfer safety, inventory scripts and redaction |
vars | object | {} | Playbook-level variables (overridden by higher-priority sources such as inventory, play.vars and the CLI's -e) |
servers | array | [] | The host list, with IP bracket ranges expanded (such as 192.0.2.[1-10]) |
inventory | object | {} | Groups of hosts (group -> { hosts, vars }); the all group sets defaults for every host |
roles | array<string> | [] | The roles loaded by the default play in the flat form (with plays, put them in each play.roles) |
tasks | array<Task> | [] | The main task list in the flat form |
handlers | array<Task> | [] | The handler list in the flat form |
plays | array<Play> | [] | The ordered list of plays |
concurrency: 5
global:
default_user: ops
default_key_path: /home/ops/.ssh/id_ed25519
known_hosts_path: /home/ops/.ssh/known_hosts
strict_host_key_check: true
vars:
app_env: prod
inventory:
web:
hosts:
- 192.0.2.10-12
vars:
http_port: 8080
plays:
- name: Deploy the application
hosts: web
serial: 1
gather_facts: true
roles:
- common
tasks:
- name: Print the host's system information
type: debug
args:
msg: "Deploying to {{ ip }} ({{ fleetkite_os_family }})"The global configuration
| Field | Type | Default | Description |
|---|---|---|---|
default_port | integer | 22 | The default SSH port (1–65535) |
default_user | string | root | The default SSH user |
default_password | string | "" | The default SSH password (accepts a Vault $FLEETKITEVAULT$... value) |
default_key_path | string | "" | The default private key path |
default_key_passphrase | string | "" | The default key passphrase (accepts a Vault value) |
default_root_password | string | "" | The default escalation password (also the fallback for become_password; accepts Vault) |
use_ssh_agent | boolean | false | Whether to sign with the local SSH_AUTH_SOCK agent |
proxy_jump | array | [] | The global jump-host chain (up to 8 hops). Each entry is a "user@host:port" string or an object with { host, port, user, password, key_path, key_passphrase, use_ssh_agent, known_hosts_path } |
strict_host_key_check | boolean | true | Whether to verify the key fingerprints of the target and the jump hosts strictly |
known_hosts_path | string | ~/.ssh/known_hosts | The path to the known_hosts file |
become | boolean | false | Whether escalation is on by default |
become_method | string | sudo | The escalation method: sudo or su |
become_user | string | root | The account to escalate to |
become_password | string | "" | The escalation password (accepts Vault; falls back to default_root_password / server.root_password when sudo has none) |
log_file | string | "" | The path of the persistent log file (rotated and compressed by default) |
log_level | string | info | The log level: debug, info, warn, error |
max_log_size | integer | 100 | The maximum size of one log file in MB |
max_log_files | integer | 10 | How many historical log files to keep |
transfer_security | object | see below | Limits on file transfers and external plugin directories |
inventory_script | object | see below | Limits on dynamic inventory scripts |
connection_pool | object | see below | SSH connection pool settings |
sensitive | object | {} | Extra redaction rules: keywords (exact key names) and patterns (substring matches) |
transfer_security holds allow_path_traversal (false), require_absolute (true), max_file_size (default 104857600, that is 100 MiB) and allowed_directories (the remote paths that may be written to or downloaded from).
inventory_script holds timeout (seconds, default 30), max_output_size (bytes, default 1 MiB), allow_subdirs (false), allowed_dirs (the directories a script may live in) and require_executable.
connection_pool holds max_idle_time (default "5m"), max_pool_size (default 100) and cleanup_interval (default "1m").
The inventory
servers[] fields
| Field | Type | Description |
|---|---|---|
ip | string | The target IP or hostname; bracket ranges such as 192.0.2.[1-5] are expanded (5 levels of nesting at most, 1000 addresses per entry) |
port | integer | Overrides the global default port |
user | string | Overrides the global default user |
password | string | Overrides the login password (accepts Vault) |
key_path | string | Overrides the private key path |
key_passphrase | string | Overrides the key passphrase (accepts Vault) |
root_password | string | Overrides the escalation password (accepts Vault) |
use_ssh_agent | boolean | Overrides whether the SSH agent is used |
proxy_jump | array / null | Overrides the global jump hosts; setting it to [] explicitly disables the inherited chain |
connection | string | The default connection for this host: ssh (default) or local |
explicit_ssh_auth | boolean | Forbids falling back to the inherited global credentials |
groups | array<string> | The groups this host belongs to |
vars | object | Inline variables for this host |
The inventory group format
inventory:
all:
vars:
env_name: staging
web:
hosts:
- 192.0.2.10 # a single IP or hostname
- 192.0.2.20-25 # a shorthand range on one subnet
- 192.0.2.30-192.0.2.32 # a full start-to-end range
- "192.0.2.40": # inline variables for one host
user: deploy
http_port: 9000
vars:
role: web-node
prod:
hosts:
- web # another group (expanded, with cycle detection)Alongside inventory, the connection keys can also be set through group variables or host_vars: user / default_user, port / default_port, password / default_password, key_path / default_key_path, key_passphrase / default_key_passphrase, root_password / default_root_password, connection and use_ssh_agent.
group_vars/ and host_vars/
If group_vars/ and host_vars/ exist next to the playbook (or under --base-dir), FleetKite loads the matching YAML or JSON files automatically, reading <name>.yml → <name>.yaml → <name>.json in that order; several variable files with the same name in one directory are also supported:
group_vars/all.ymlapplies to every host;group_vars/<group_name>.ymlapplies to the members of that group;host_vars/<ip>.yml(or the asset name) applies to that host.
When a host belongs to several groups that define the same variable, the group that sorts later alphabetically wins, and validate / inspect report the conflict in their warnings.
Dynamic inventory scripts (inventory_script)
When global.inventory_script.allowed_dirs enables it and a script is configured, FleetKite can run a local inventory script (a Python or shell script printing JSON), bounded by timeout (30 s by default) and max_output_size (1 MiB by default).
The host selector syntax
A play's hosts and the CLI's --limit share one selector language:
- everything:
allor* - union (comma or colon separated):
web,dborweb:192.0.2.10 - intersection (
&):prod:&web(hosts in bothprodandweb) - exclusion (
!):all:!canary,web:!192.0.2.12 - wildcards and exact ports:
web*,192.0.2.*,192.0.2.10:2222
Play fields
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | The play's name, shown in logs, summaries and HTML reports |
hosts | string | — | Required. The host selector (such as all or web,&prod) |
connection | string | "" | The default connection for this play: ssh or local |
gather_facts | boolean | true | Whether to gather host facts before the roles and tasks run (equivalent to a leading read-only setup, carrying the implicit always tag) |
serial | int / string / array | unlimited | How many hosts advance per batch: an integer (2), a percentage ("25%", rounded down to at least one host) or a progressive list ([1, "20%", "100%"]). A failure in any batch aborts the batches after it |
vars | object | {} | Play-level variables, valid only while this play runs |
roles | array<string> | [] | The roles loaded statically by this play |
tasks | array<Task> | [] | The play's task list, appended after the statically loaded roles' tasks |
handlers | array<Task> | [] | The play's handler list, appended after the statically loaded roles' handlers |
Role directories and path resolution
A standard role lives in roles/<role_name>/ next to the playbook (or in the project's private workspace):
roles/nginx_proxy/
├── tasks/
│ ├── main.yml # the entry point for a static reference or a default include_role (must exist)
│ └── reload.yml # a split-out task file
├── handlers/
│ └── main.yml # loaded by default when present
├── vars/
│ └── main.yml # the default role variables
├── templates/
│ └── site.conf.tpl # template files
└── files/
└── cert.pem # files uploaded as-isThe lookup rules that matter:
- Role directory priority: when a project-private role space exists, the private
roles/<name>/is searched first and the workspace's publicroles/<name>/is the fallback. - Variable scope differs:
- listed statically in a play's
roles:,vars/main.ymlis merged into the globalvarsat load time, and the role'stasksandhandlersare prepended to the play; - called dynamically through an
include_roletask, the role's variables are merged into the current host'sVariableStorewhen that step is reached, and the role's handlers are registered into the current play at that moment, before the role'stasksrun.
- listed statically in a play's
- Relative paths inside a role differ:
include_tasksinside a role searches, in order: the directory of the current task file →roles/<name>/tasks/→ the role root;include_varsinside a role searches, in order:roles/<name>/vars/→ the directory of the current task file → the role root;- local files and templates (
template.src,transfer_file.local_path, a localunarchive.src) always resolve relative to the role rootroles/<name>/.
Task fields (tasks / handlers)
These fields sit at the root of the task object, level with name / type / args, not inside args:
| Field | Type | Description |
|---|---|---|
name | string | The task's description, shown in logs and reports; handlers match notify by this name |
type | string | A plugin name (such as shell, file or publisher/tls-check) or an include directive (include_tasks / include_vars / include_role); omitted inside a block |
args | object | The arguments passed to the plugin or directive |
when | string / array<string> | A CEL condition or a list of conditions (list items are combined with AND) |
tags | array<string> | Task tags; the built-in special tags are always (still runs under a normal --tags, unless --skip-tags always) and never (runs only when selected explicitly) |
loop | array / object / string | A list, a mapping, or a template string naming a list or mapping variable (such as "{{ sites }}") |
loop_control | object | { indexed_items: true, label: "..." }. With indexed_items on, index and value are available |
register | string | The variable name the task's result is registered under |
ignore_errors | boolean | When true, a failure of this task does not stop the play (a warning is printed) |
changed_when | string | A CEL expression overriding the changed / ok reporting (such as changed_when: "false") |
failed_when | string | A CEL expression overriding the failure decision (may use result.* and result_<field>) |
until | string | The CEL condition a retry loop waits for; used with retries and delay |
retries | integer | The maximum number of attempts with until (default 3) |
delay | integer | The seconds between retries with until (default 5) |
async | integer | The timeout of the remote background task in seconds (> 0 enables it; currently for shell tasks with a command); skipped in --check mode |
poll | integer | The seconds between background-task polls; 0 returns fleetkite_job_id immediately (fire-and-forget) |
notify | array<string> | The handlers to notify when this task ends as changed |
diff | boolean | When the CLI runs with --diff, a task can set this to false to suppress its diff (pair it with no_log: true for secrets) |
no_log | boolean | When true, the task's output, diff and desktop detail records are suppressed, and its result is not written to the cross-play fact cache |
run_once | boolean | Run once on the first available host of each serial batch, sharing the result and the facts with the rest of the batch |
timeout | string / integer | The time limit of one attempt, such as 500ms, 2m or a whole number of seconds. Takes precedence over the run's default task timeout |
delegate_to | string | Run this task on another inventory host instead (using that host's connection, with ip and user temporarily replaced) |
connection | string | Overrides the connection mode: ssh or local |
become | boolean | Overrides the global escalation switch (true / false) |
become_method | string | Overrides the escalation method: sudo or su |
become_user | string | Overrides the account to escalate to |
become_password | string | Overrides the escalation password (accepts Vault) |
block | array<Task> | The main task block, nestable. Subtasks inherit tags, escalation, connection, delegation and ignore_errors, and may override them. A block itself does not support loop |
rescue | array<Task> | Runs when a task in the block fails; if every rescue task succeeds, the exception is caught and the play continues |
always | array<Task> | Cleanup tasks that always run when leaving the block, whether the block and the rescue succeeded or not |
compensate | array<Task> | Rollback steps attached to an ordinary task; if the play fails later, the registered compensations run in LIFO order |
run_once and serial
Without serial the whole play is one batch. With serial: 2, four hosts split into two batches and the task runs at most twice. The first available host of each batch decides whether to run; later tasks in the same batch can read the registered value on any of its hosts.
- name: Read the release marker for this batch
type: shell
run_once: true
args:
command: "printf '%s' release-2026"
register: release_marker
- name: Verify the release marker
type: assert
args:
that: ['release_marker.stdout == "release-2026"']Work that must happen exactly once across the whole playbook belongs on one specific inventory host, or in its own play.
Task timeouts
A task timeout can be set in the desktop task form, or as the default for a run in the project dialog. The CLI uses --task-timeout 2m; the older --timeout remains the fallback for the SSH connection limit and synchronous actions. A task timeout applies to every attempt. External plugins stay bounded by a 60-second cap. For asynchronous tasks, async bounds the remote process while the explicit or default task timeout bounds how long the controller starts and waits for it.
Next steps
- Variables and templates — variable priority, host facts and expressions
- Built-in plugins — the full parameter reference for every
type