Built-in Plugins
The complete reference for 27 built-in plugins and 3 orchestration directives.
FleetKite ships 27 plugins and 3 orchestration directives (the same set fleetkite plugins list prints).
The parameter tables on this page are exported by the engine itself, so they cannot drift from the arguments that are actually registered; fleetkite plugins show <name> prints the same information at any time.
Capability and behaviour at a glance
| Name | Category | --check preview | --diff | connection: local | become | Typical register fields |
|---|---|---|---|---|---|---|
include_tasks | Orchestration | Inherits its subtasks | Depends on the subtasks | Supported | Inherited by the subtasks | — |
include_vars | Orchestration | Inherited / loaded normally | — | Supported | — | — |
include_role | Orchestration | Inherits its subtasks | Depends on the subtasks | Supported | Inherited by the subtasks | — |
shell | Command execution | Skipped | — | Supported | Supported | stdout, stdout_lines, rc |
async_status | Async query | Supported (read-only) | — | SSH only | — | fleetkite_job_id, finished, rc, stdout |
expect | Interactive command | Skipped | — | SSH only | Supported | command, output (plus error on failure) |
setup | Fact collection | Supported (read-only) | — | Supported | — | the whole fleetkite_* fact set |
set_fact | Variable registration | Supported | — | Supported | — | set_facts, cacheable |
debug | Debug output | Supported | — | Supported | — | msg / var, value / variables |
assert | Assertion | Supported | — | Supported | — | msg, evaluated, successful (plus failed, failed_messages on failure) |
fail | Explicit failure | Supported | — | Supported | — | msg |
file | Path management | Supported | — | Supported | Supported | status, msg |
stat | File metadata | Supported (read-only) | — | Supported | — | exists, path, size, perms, user, group, mtime, isdir, isreg, checksum, md5 |
lineinfile | Line editing | Supported | Supported | Supported | Supported | diff (with --diff) |
transfer_file | SFTP transfer | Supported | Supported | SSH only | Supported | diff (for a single text file with --diff) |
template | Template rendering | Supported | Supported | Supported | Supported | diff (with --diff) |
unarchive | Archive extraction | Supported | — | Supported | Supported | src, dest |
get_url | Remote download | Supported | — | Supported | Supported | url, dest |
http | HTTP request | Read-only methods only | — | Supported | — | status_code (plus json, content) |
wait_for | Port / file wait | Supported (read-only) | — | Supported (files only) | — | status, msg |
user | Linux account | Skipped | — | SSH only | Supported | stdout |
cron | Scheduled task | Supported | — | SSH only | Supported | status, msg |
apt | Debian package | Supported | — | SSH only | Supported | status, msg |
yum / dnf | Red Hat package | Supported | — | SSH only | Supported | status, msg |
service | Generic service | Supported | — | SSH only | Supported | status, msg |
systemd | Systemd unit | Skipped | — | SSH only | Not supported (connect as a privileged user) | status, msg |
git | Git checkout | Skipped | — | SSH only | — | status, msg |
docker / podman | Container | Skipped | — | SSH only | — | status, msg |
Plugin details
include_tasks
Load a YAML task list from the local filesystem and expand it in place when the run reaches this step.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
file | string | yes | — | Task file. Relative paths are based on the current task source. |
register fields: —
Example:
- name: 加载发行版专属软件安装流程
type: include_tasks
when: "fleetkite_os_family == 'Debian'"
args:
file: "tasks/debian_setup.yml"include_vars
Read a YAML mapping and merge it into the current host's VariableStore for the current play.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
file | string | yes | — | Variable file. Relative paths are based on the current task source. |
register fields: —
Example:
- name: 加载对应环境配置变量
type: include_vars
args:
file: "vars/{{ app_env }}.yml"
- name: 引用刚合入的变量
type: debug
args:
msg: "Loaded API endpoint: {{ api_base_url }}"include_role
Call a role's tasks at run time, merging its variables and handlers into the current play.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Role name. |
tasks_from | string | main | Task file under roles/<name>/tasks/ without requiring a .yml/.yaml suffix. | |
vars_from | string | — | Variable file under roles/<name>/vars/. | |
handlers_from | string | — | Handler file under roles/<name>/handlers/. |
register fields: —
Example:
- name: 执行数据库备份子流程
type: include_role
when: "'db' in group_names_hint"
args:
name: postgres
tasks_from: backup
vars_from: prod
handlers_from: mainshell
Run a command on the remote host, or on the controller under connection: local.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
command | string | yes | — | Remote command. |
expect_pairs | array of objects | — | Optional interactive prompt/answer pairs using prompt and answer keys. | |
end_prompt | string | [#$]\s*$ | Completion pattern for interactive execution. |
register fields: 同步模式返回 rc(退出码)、stdout(标准输出与错误合并文本)、stdout_lines(按行拆分)。异步发射返回 fleetkite_job_id、pid、started、output_file;poll > 0 轮询结束后追加 finished、rc、stdout。
Example:
- name: 查询 Nginx 版本(只读不报 changed)
type: shell
changed_when: "false"
args:
command: "nginx -v 2>&1"
register: nginx_ver
- name: 校验输出内容
type: assert
args:
that:
- "nginx_ver.rc == 0"
- "'nginx/' in nginx_ver.stdout"async_status
Query the status and output of a detached async task on the target.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
jid | string | yes | — | Job ID returned by an async task with poll: 0 (fleetkite_async_<nanoseconds>). |
register fields: 运行中返回 fleetkite_job_id、finished: false;已完成返回 fleetkite_job_id、finished: true、rc、stdout。
Example:
- name: 轮询等待异步构建完成
type: async_status
args:
jid: "{{ reindex_job.fleetkite_job_id }}"
register: job_state
until: "job_state.finished == true"
retries: 20
delay: 2expect
Answer known prompts of an interactive command with regular expressions.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
command | string | yes | — | Remote command. |
responses | object | yes | — | Map prompt patterns to responses. |
timeout | integer | 30 | Timeout in seconds. | |
end_prompt | string | — | Completion prompt pattern. | |
chdir | string | — | Remote working directory. | |
output_var | string | — | Variable to receive output. |
register fields: command(渲染后命令)、output(交互终端输出文本);失败时额外带 error。
Example:
- name: 交互式初始化测试凭证
type: expect
no_log: true
args:
command: "/usr/local/bin/init-tool.sh"
chdir: "/opt/tool"
timeout: 60
responses:
"Enter passphrase:": "{{ tool_vault_secret }}"
"Confirm \\(yes/no\\):": "yes"setup
Collect Linux system facts into the fleetkite_* variables.
Arguments:
No arguments.
register fields: 完整 fleetkite_* 键值集合(同时已自动平铺写入当前主机变量作用域,无需 register 即可直接访问 {{ fleetkite_os_family }})。
Example:
- name: 显式采集/刷新系统事实
type: setup
register: sys_factsset_fact
Define variables at run time, optionally persisting them into later plays.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
* | any | — | Each argument name becomes a variable and keeps its value type. |
register fields: set_facts(写入的变量名列表)、cacheable(布尔值)。
Example:
- name: 推导日志目录并缓存主机状态
type: set_fact
args:
app_port: 8443
log_dir: "/var/log/{{ fleetkite_hostname }}"
deploy_ready: true
cacheable: truedebug
Print a message, a variable's value, or the whole variable snapshot.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
msg | string | — | Message. | |
var | string | — | Variable name or dotted path. | |
verbosity | integer | — | Skip the message when greater than zero. |
register fields: 指定 var 时返回 var、value;指定 msg 时返回 msg;均省略时返回 variables。
Example:
- name: 打印探测到的网卡主 IP
type: debug
args:
var: fleetkite_default_ipv4.addressassert
Require one or more CEL expressions to be true.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
that | string or array of strings | yes | — | One CEL expression or a list of expressions. |
success_msg | string | — | Message on success. | |
fail_msg | string | — | Message on failure. | |
quiet | boolean | — | Suppress the default success message. |
register fields: 成功时含 msg、evaluated(总数)、successful(通过数);失败时追加 failed(失败数)、failed_messages。
Example:
- name: 校验生产主机最低硬件规格
type: assert
args:
that:
- "fleetkite_processor_vcpus >= 2"
- "fleetkite_memtotal_mb >= 1800"
fail_msg: "主机 {{ ip }} CPU 或内存不足,无法继续部署"fail
Fail the task with an explicit message.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
msg | string | — | Failure message. | |
when | string | — | Plugin-local condition. Prefer task-level when. |
register fields: msg。
Example:
- name: 禁止在非 Linux 兼容发行版继续
type: fail
when: "fleetkite_os_family != 'Debian' && fleetkite_os_family != 'RedHat'"
args:
msg: "当前不受支持的系统家族: {{ fleetkite_os_family }}"file
Manage paths and their permissions.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | yes | — | Remote filesystem path. |
state | string | file, directory, touch, absent | Desired state or operation. | |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. |
register fields: status、msg。
Example:
- name: 创建应用运行目录
type: file
become: true
args:
path: "/opt/demoapp/{{ item }}"
state: directory
mode: "0755"
owner: ops
group: ops
loop:
- conf
- logsstat
Read file and directory metadata and checksums.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | yes | — | Remote filesystem path. |
get_checksum | boolean | — | Calculate SHA-256. | |
get_md5 | boolean | — | Calculate MD5. | |
follow | boolean | — | Follow symbolic links. |
register fields: 不存在时返回 exists: false 与 path;存在时返回 exists、path、name、size(字节)、perms、user、group、mtime、atime、isdir、isreg、islnk、ischr、isblk、isfifo、issock,开启对应选项且为常规文件时另带 checksum(SHA-256)和 / 或 md5。
Example:
- name: 检查配置文件是否存在及校验和
type: stat
args:
path: /etc/demoapp/app.conf
get_checksum: true
register: cfg_statlineinfile
Ensure a line is present in a file, or remove matching lines.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | yes | — | Remote filesystem path. |
line | string | — | Required when state is present. | |
regexp | string | — | Go regular expression for the target line. | |
state | string | present, absent | Desired state or operation. | |
create | boolean | — | Allow creating a missing file. | |
backup | boolean | — | Save the previous content before replacing the file. | |
insertafter | string | — | Insertion pattern or EOF. | |
insertbefore | string | — | Insertion pattern or BOF. | |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. |
register fields: 当开启 --diff 且发生实际 / 预计变更时返回 diff。
Example:
- name: 禁用 SSH 密码登录
type: lineinfile
become: true
args:
path: /etc/ssh/sshd_config
regexp: "^#?PasswordAuthentication\\s+"
line: "PasswordAuthentication no"
backup: true
notify:
- 重载 SSH 服务transfer_file
Upload or download a file over SFTP.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
local_path | string | yes | — | Controller-side path. |
remote_path | string | yes | — | Absolute path on the target. |
direction | string | upload, download | Desired state or operation. | |
recursive | boolean | — | Upload a workspace directory. | |
compression | string | none, gzip | Use gzip only for recursive uploads where saving bandwidth matters. | |
exclude | array of strings | — | Exclude matching names or workspace-relative paths during recursive upload. | |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. |
register fields: 在开启 --diff 的文本单文件上传时返回 diff。
Example:
- name: 同步静态站点文件
type: transfer_file
args:
local_path: dist/web
remote_path: /var/www/demoapp
direction: upload
recursive: true
compression: gzip
exclude:
- "*.map"
- ".DS_Store"template
Render a controller-side template to a remote file.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
src | string | yes | — | Local template source. |
dest | string | yes | — | Remote destination. |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. | |
engine | string | default, gotmpl | Desired state or operation. | |
delimiters | array of strings | — | Custom opening and closing Go template delimiters. |
register fields: 在开启 --diff 且发生变更时返回 diff。
Example:
- name: 生成应用配置
type: template
become: true
args:
src: templates/app.conf.tmpl
dest: /etc/demoapp/app.conf
engine: gotmpl
delimiters: ["[[", "]]"]
mode: "0640"
notify:
- 重启 DemoAppunarchive
Extract an archive into a remote directory.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
src | string | yes | — | Archive path. |
dest | string | yes | — | Remote destination directory. |
remote_src | boolean | — | Read src on the target instead of uploading it. | |
creates | string | — | Skip when this remote path already exists. | |
extra_opts | string | — | Additional archive tool options. | |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. |
register fields: 实际执行解压变更后包含 src、dest。
Example:
- name: 解压发布包(存在 VERSION 文件时幂等跳过)
type: unarchive
args:
src: fixtures/demoapp-pkg.tar.gz
dest: /opt/demoapp
creates: /opt/demoapp/VERSIONget_url
Download a URL to the target.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | yes | — | HTTP or HTTPS URL. |
dest | string | yes | — | Remote destination file. |
checksum | string | — | Expected checksum, for example sha256:<hex>. | |
force | boolean | — | Download even if the destination already exists. | |
timeout | integer | 30 | Download timeout in seconds. | |
headers | object or string | — | Map of headers or a single header line. | |
mode | string | — | Octal mode as a quoted string, for example '0644'. | |
owner | string | — | Remote owner. | |
group | string | — | Remote group. |
register fields: 成功变更后包含 url、dest。
Example:
- name: 下载带 SHA-256 校验的发布归档
type: get_url
args:
url: "https://releases.example.test/app-1.2.0.tar.gz"
dest: /tmp/app-1.2.0.tar.gz
checksum: "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
mode: "0644"http
Send an HTTP(S) request from the controller or the target.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | yes | — | HTTP(S) endpoint. Do not put credentials in the URL. |
method | string | GET, HEAD, OPTIONS, POST, PUT, PATCH, DELETE | Desired state or operation. | |
location | string | control, target | Desired state or operation. | |
headers | object | — | Map from header name to string value. | |
status_code | integer or array of integers | 200 | Expected HTTP status code or list of codes. | |
timeout | integer | 10 | Request timeout in seconds. | |
body_format | string | text, json | Desired state or operation. | |
return_content | boolean | — | Expose raw response content in the registered result. | |
json_body | any | — | JSON body for a write method. |
register fields: status_code(整数);满足选项时附带 json、content。
Example:
- name: 探测本地微服务就绪接口
type: http
args:
url: "http://127.0.0.1:8080/healthz"
location: target
method: GET
status_code: [200, 204]
body_format: json
return_content: true
register: api_healthwait_for
Wait for a TCP port or a file condition to be met.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
host | string | — | Endpoint for TCP checks. Defaults to 127.0.0.1 from the target. | |
port | integer | — | TCP port to check. | |
path | string | — | Remote file to check. | |
state | string | started, stopped, present, absent | Desired state or operation. | |
timeout | integer | 300 | Maximum wait in seconds. | |
delay | integer | — | Initial delay in seconds. | |
search_regex | string | — | Required file content pattern. | |
exclude_regex | string | — | Forbidden file content pattern. |
register fields: status、msg。
Example:
- name: 等待应用端口开放(最多等待 30 秒)
type: wait_for
args:
host: 127.0.0.1
port: 8080
state: started
delay: 1
timeout: 30user
Create, update, or remove a Linux account.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Target account name. |
state | string | present, absent | Desired state or operation. | |
uid | integer or string | — | Numeric user ID. | |
group | string | — | Primary group. | |
groups | array of strings | — | Supplementary groups. Omit to preserve existing membership. | |
shell | string | — | Login shell. | |
home | string | — | Home directory. | |
comment | string | — | Account description. | |
create_home | boolean | True | Create the home directory. | |
remove | boolean | — | Also remove the home directory when the account is removed. | |
password | string | — | Account password hash. Prefer a Vault reference. |
register fields: 执行修改命令时返回 stdout。
Example:
- name: 创建只读部署应用账号
type: user
become: true
args:
name: app_runner
state: present
shell: /usr/sbin/nologin
create_home: truecron
Manage a named crontab entry.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | FleetKite crontab entry name. |
job | string | — | Command required when state is present. | |
minute | string | * | Cron minute. | |
hour | string | * | Cron hour. | |
day | string | * | Day of month. | |
month | string | * | Cron month. | |
weekday | string | * | Day of week. | |
user | string | — | Crontab owner. Omit for the current user. | |
state | string | present, absent | Desired state or operation. | |
disabled | boolean | — | Keep the entry commented out. |
register fields: status、msg。
Example:
- name: 每天凌晨 2:30 清理临时文件
type: cron
become: true
args:
name: clean-demoapp-tmp
user: root
minute: "30"
hour: "2"
job: "/usr/bin/find /opt/demoapp/tmp -type f -mtime +7 -delete"
state: presentapt
Install or remove a Debian-family package.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Package name. apt also accepts a local .deb path on the target. |
state | string | present, absent | Desired state or operation. | |
update_cache | boolean | — | Refresh package metadata before a change. Accepts booleans and yes/no. |
register fields: status、msg。
Example:
- name: 确保 Debian/Ubuntu 主机装有 curl 与 jq
type: apt
become: true
when: "fleetkite_os_family == 'Debian'"
loop:
- curl
- jq
args:
name: "{{ item }}"
state: presentyum
Install or remove a Red Hat-family package using YUM.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Package name. |
state | string | present, absent | Desired state or operation. | |
update_cache | boolean | — | Refresh package metadata before a change. Accepts booleans and yes/no. |
register fields: status、msg。
Example:
- name: 在 Rocky Linux 上安装常用基础工具
type: yum
become: true
when: "fleetkite_os_family == 'RedHat'"
args:
name: tar
state: presentdnf
Install or remove a Red Hat-family package using DNF.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Package name. apt also accepts a local .deb path on the target. |
state | string | present, absent | Desired state or operation. | |
update_cache | boolean | — | Refresh package metadata before a change. Accepts booleans and yes/no. |
register fields: status、msg。
Example:
- name: 在 Rocky Linux 上安装常用基础工具
type: dnf
become: true
when: "fleetkite_os_family == 'RedHat'"
args:
name: tar
state: presentservice
Manage a service and its startup state.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Remote service or systemd unit name. |
state | string | started, stopped, restarted, reloaded | Desired state or operation. | |
enabled | boolean | — | Whether to enable startup at boot. Omit to leave it unchanged. |
register fields: status、msg。
Example:
- name: 确保 cron 服务处于运行与开机自启状态
type: service
become: true
args:
name: cron
state: started
enabled: truesystemd
Manage a systemd unit and reload its definitions.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Remote service or systemd unit name. |
state | string | started, stopped, restarted, reloaded | Desired state or operation. | |
enabled | boolean | — | Whether to enable startup at boot. Omit to leave it unchanged. | |
daemon_reload | boolean | — | Reload systemd unit definitions. |
register fields: status、msg。
Example:
- name: 重新加载 unit 配置并启动服务
type: systemd
args:
name: demoapp.service
daemon_reload: true
state: started
enabled: truegit
Clone or update a Git checkout on the target.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
repo | string | yes | — | Repository URL or remote-local path. |
dest | string | yes | — | Remote checkout directory. |
version | string | HEAD | Git branch, tag or revision. | |
force | boolean | — | Reset local changes before updating. |
register fields: status、msg。
Example:
- name: 检出发布分支代码
type: git
args:
repo: "https://git.example.test/team/app.git"
dest: /opt/app-src
version: release-1.0
force: falsedocker
Start, stop, or remove a Docker container.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Container name. |
image | string | — | Container image. Provide for state started. | |
state | string | started, stopped, absent | Desired state or operation. | |
ports | array of strings | — | Published port mappings. | |
env | object | — | Container environment values. |
register fields: status、msg。
Example:
- name: 运行 Nginx 反向代理容器
type: docker
args:
name: edge-nginx
image: nginx:alpine
state: started
ports:
- "8080:80"
env:
NGINX_ENV: prodpodman
Start, stop, or remove a Podman container.
Arguments:
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Container name. |
image | string | — | Container image. Provide for state started. | |
state | string | started, stopped, absent | Desired state or operation. | |
ports | array of strings | — | Published port mappings. | |
env | object | — | Container environment values. |
register fields: status、msg。
Example:
- name: 运行 Nginx 反向代理容器
type: podman
args:
name: edge-nginx
image: nginx:alpine
state: started
ports:
- "8080:80"