Skip to Content
FleetKiteFleetKite

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

NameCategory--check preview--diffconnection: localbecomeTypical register fields
include_tasksOrchestrationInherits its subtasksDepends on the subtasksSupportedInherited by the subtasks—
include_varsOrchestrationInherited / loaded normally—Supported——
include_roleOrchestrationInherits its subtasksDepends on the subtasksSupportedInherited by the subtasks—
shellCommand executionSkipped—SupportedSupportedstdout, stdout_lines, rc
async_statusAsync querySupported (read-only)—SSH only—fleetkite_job_id, finished, rc, stdout
expectInteractive commandSkipped—SSH onlySupportedcommand, output (plus error on failure)
setupFact collectionSupported (read-only)—Supported—the whole fleetkite_* fact set
set_factVariable registrationSupported—Supported—set_facts, cacheable
debugDebug outputSupported—Supported—msg / var, value / variables
assertAssertionSupported—Supported—msg, evaluated, successful (plus failed, failed_messages on failure)
failExplicit failureSupported—Supported—msg
filePath managementSupported—SupportedSupportedstatus, msg
statFile metadataSupported (read-only)—Supported—exists, path, size, perms, user, group, mtime, isdir, isreg, checksum, md5
lineinfileLine editingSupportedSupportedSupportedSupporteddiff (with --diff)
transfer_fileSFTP transferSupportedSupportedSSH onlySupporteddiff (for a single text file with --diff)
templateTemplate renderingSupportedSupportedSupportedSupporteddiff (with --diff)
unarchiveArchive extractionSupported—SupportedSupportedsrc, dest
get_urlRemote downloadSupported—SupportedSupportedurl, dest
httpHTTP requestRead-only methods only—Supported—status_code (plus json, content)
wait_forPort / file waitSupported (read-only)—Supported (files only)—status, msg
userLinux accountSkipped—SSH onlySupportedstdout
cronScheduled taskSupported—SSH onlySupportedstatus, msg
aptDebian packageSupported—SSH onlySupportedstatus, msg
yum / dnfRed Hat packageSupported—SSH onlySupportedstatus, msg
serviceGeneric serviceSupported—SSH onlySupportedstatus, msg
systemdSystemd unitSkipped—SSH onlyNot supported (connect as a privileged user)status, msg
gitGit checkoutSkipped—SSH only—status, msg
docker / podmanContainerSkipped—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:

ArgumentTypeRequiredDefaultDescription
filestringyes—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:

ArgumentTypeRequiredDefaultDescription
filestringyes—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:

ArgumentTypeRequiredDefaultDescription
namestringyes—Role name.
tasks_fromstringmainTask file under roles/<name>/tasks/ without requiring a .yml/.yaml suffix.
vars_fromstring—Variable file under roles/<name>/vars/.
handlers_fromstring—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: main

shell

Run a command on the remote host, or on the controller under connection: local.

Arguments:

ArgumentTypeRequiredDefaultDescription
commandstringyes—Remote command.
expect_pairsarray of objects—Optional interactive prompt/answer pairs using prompt and answer keys.
end_promptstring[#$]\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:

ArgumentTypeRequiredDefaultDescription
jidstringyes—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: 2

expect

Answer known prompts of an interactive command with regular expressions.

Arguments:

ArgumentTypeRequiredDefaultDescription
commandstringyes—Remote command.
responsesobjectyes—Map prompt patterns to responses.
timeoutinteger30Timeout in seconds.
end_promptstring—Completion prompt pattern.
chdirstring—Remote working directory.
output_varstring—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_facts

set_fact

Define variables at run time, optionally persisting them into later plays.

Arguments:

ArgumentTypeRequiredDefaultDescription
*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: true

debug

Print a message, a variable's value, or the whole variable snapshot.

Arguments:

ArgumentTypeRequiredDefaultDescription
msgstring—Message.
varstring—Variable name or dotted path.
verbosityinteger—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.address

assert

Require one or more CEL expressions to be true.

Arguments:

ArgumentTypeRequiredDefaultDescription
thatstring or array of stringsyes—One CEL expression or a list of expressions.
success_msgstring—Message on success.
fail_msgstring—Message on failure.
quietboolean—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:

ArgumentTypeRequiredDefaultDescription
msgstring—Failure message.
whenstring—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:

ArgumentTypeRequiredDefaultDescription
pathstringyes—Remote filesystem path.
statestringfile, directory, touch, absentDesired state or operation.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—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
    - logs

stat

Read file and directory metadata and checksums.

Arguments:

ArgumentTypeRequiredDefaultDescription
pathstringyes—Remote filesystem path.
get_checksumboolean—Calculate SHA-256.
get_md5boolean—Calculate MD5.
followboolean—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_stat

lineinfile

Ensure a line is present in a file, or remove matching lines.

Arguments:

ArgumentTypeRequiredDefaultDescription
pathstringyes—Remote filesystem path.
linestring—Required when state is present.
regexpstring—Go regular expression for the target line.
statestringpresent, absentDesired state or operation.
createboolean—Allow creating a missing file.
backupboolean—Save the previous content before replacing the file.
insertafterstring—Insertion pattern or EOF.
insertbeforestring—Insertion pattern or BOF.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—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:

ArgumentTypeRequiredDefaultDescription
local_pathstringyes—Controller-side path.
remote_pathstringyes—Absolute path on the target.
directionstringupload, downloadDesired state or operation.
recursiveboolean—Upload a workspace directory.
compressionstringnone, gzipUse gzip only for recursive uploads where saving bandwidth matters.
excludearray of strings—Exclude matching names or workspace-relative paths during recursive upload.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—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:

ArgumentTypeRequiredDefaultDescription
srcstringyes—Local template source.
deststringyes—Remote destination.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—Remote group.
enginestringdefault, gotmplDesired state or operation.
delimitersarray 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:
    - 重启 DemoApp

unarchive

Extract an archive into a remote directory.

Arguments:

ArgumentTypeRequiredDefaultDescription
srcstringyes—Archive path.
deststringyes—Remote destination directory.
remote_srcboolean—Read src on the target instead of uploading it.
createsstring—Skip when this remote path already exists.
extra_optsstring—Additional archive tool options.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—Remote group.

register fields: 实际执行解压变更后包含 src、dest。

Example:

- name: 解压发布包(存在 VERSION 文件时幂等跳过)
  type: unarchive
  args:
    src: fixtures/demoapp-pkg.tar.gz
    dest: /opt/demoapp
    creates: /opt/demoapp/VERSION

get_url

Download a URL to the target.

Arguments:

ArgumentTypeRequiredDefaultDescription
urlstringyes—HTTP or HTTPS URL.
deststringyes—Remote destination file.
checksumstring—Expected checksum, for example sha256:<hex>.
forceboolean—Download even if the destination already exists.
timeoutinteger30Download timeout in seconds.
headersobject or string—Map of headers or a single header line.
modestring—Octal mode as a quoted string, for example '0644'.
ownerstring—Remote owner.
groupstring—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:

ArgumentTypeRequiredDefaultDescription
urlstringyes—HTTP(S) endpoint. Do not put credentials in the URL.
methodstringGET, HEAD, OPTIONS, POST, PUT, PATCH, DELETEDesired state or operation.
locationstringcontrol, targetDesired state or operation.
headersobject—Map from header name to string value.
status_codeinteger or array of integers200Expected HTTP status code or list of codes.
timeoutinteger10Request timeout in seconds.
body_formatstringtext, jsonDesired state or operation.
return_contentboolean—Expose raw response content in the registered result.
json_bodyany—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_health

wait_for

Wait for a TCP port or a file condition to be met.

Arguments:

ArgumentTypeRequiredDefaultDescription
hoststring—Endpoint for TCP checks. Defaults to 127.0.0.1 from the target.
portinteger—TCP port to check.
pathstring—Remote file to check.
statestringstarted, stopped, present, absentDesired state or operation.
timeoutinteger300Maximum wait in seconds.
delayinteger—Initial delay in seconds.
search_regexstring—Required file content pattern.
exclude_regexstring—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: 30

user

Create, update, or remove a Linux account.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Target account name.
statestringpresent, absentDesired state or operation.
uidinteger or string—Numeric user ID.
groupstring—Primary group.
groupsarray of strings—Supplementary groups. Omit to preserve existing membership.
shellstring—Login shell.
homestring—Home directory.
commentstring—Account description.
create_homebooleanTrueCreate the home directory.
removeboolean—Also remove the home directory when the account is removed.
passwordstring—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: true

cron

Manage a named crontab entry.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—FleetKite crontab entry name.
jobstring—Command required when state is present.
minutestring*Cron minute.
hourstring*Cron hour.
daystring*Day of month.
monthstring*Cron month.
weekdaystring*Day of week.
userstring—Crontab owner. Omit for the current user.
statestringpresent, absentDesired state or operation.
disabledboolean—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: present

apt

Install or remove a Debian-family package.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Package name. apt also accepts a local .deb path on the target.
statestringpresent, absentDesired state or operation.
update_cacheboolean—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: present

yum

Install or remove a Red Hat-family package using YUM.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Package name.
statestringpresent, absentDesired state or operation.
update_cacheboolean—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: present

dnf

Install or remove a Red Hat-family package using DNF.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Package name. apt also accepts a local .deb path on the target.
statestringpresent, absentDesired state or operation.
update_cacheboolean—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: present

service

Manage a service and its startup state.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Remote service or systemd unit name.
statestringstarted, stopped, restarted, reloadedDesired state or operation.
enabledboolean—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: true

systemd

Manage a systemd unit and reload its definitions.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Remote service or systemd unit name.
statestringstarted, stopped, restarted, reloadedDesired state or operation.
enabledboolean—Whether to enable startup at boot. Omit to leave it unchanged.
daemon_reloadboolean—Reload systemd unit definitions.

register fields: status、msg。

Example:

- name: 重新加载 unit 配置并启动服务
  type: systemd
  args:
    name: demoapp.service
    daemon_reload: true
    state: started
    enabled: true

git

Clone or update a Git checkout on the target.

Arguments:

ArgumentTypeRequiredDefaultDescription
repostringyes—Repository URL or remote-local path.
deststringyes—Remote checkout directory.
versionstringHEADGit branch, tag or revision.
forceboolean—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: false

docker

Start, stop, or remove a Docker container.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Container name.
imagestring—Container image. Provide for state started.
statestringstarted, stopped, absentDesired state or operation.
portsarray of strings—Published port mappings.
envobject—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: prod

podman

Start, stop, or remove a Podman container.

Arguments:

ArgumentTypeRequiredDefaultDescription
namestringyes—Container name.
imagestring—Container image. Provide for state started.
statestringstarted, stopped, absentDesired state or operation.
portsarray of strings—Published port mappings.
envobject—Container environment values.

register fields: status、msg。

Example:

- name: 运行 Nginx 反向代理容器
  type: podman
  args:
    name: edge-nginx
    image: nginx:alpine
    state: started
    ports:
      - "8080:80"

On this page