GET /api/hosts
列出所有主机

GET /api/hostgroups/:hostgroup_id/hosts
列出主机组中的所有主机

GET /api/locations/:location_id/hosts
列出每个位置的主机

GET /api/organizations/:organization_id/hosts
列出每个机构的主机

GET /api/environments/:environment_id/hosts
列出每个位置的主机

参数

参数名字 描述
hostgroup_id
选填

主机组 ID

Validations:

  • Must be String

location_id
选填

位置 ID

Validations:

  • Must be String

organization_id
选填

机构 ID

Validations:

  • Must be String

environment_id
选填

环境 ID

Validations:

  • Must be String

search
选填

过滤结果

Validations:

  • Must be String

order
选填

结果排序

Validations:

  • Must be String

page
选填

页数

Validations:

  • Must be String

per_page
选填

每个请求中的条目数

Validations:

  • Must be String


GET /api/hosts/:id
显示主机

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/hosts
生成主机

参数

参数名字 描述
host
必填

Validations:

  • Must be a Hash

host[name]
必填

Validations:

  • Must be String

host[location_id]
必填

如果启用位置则需填写。

Validations:

  • Must be a number.

host[organization_id]
必填

如果启用机构则需要填写

Validations:

  • Must be a number.

host[environment_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be String

host[ip]
选填 , 允许空值

如果使用附带 DHCP 代理服务器的子网则不需要

Validations:

  • Must be String

host[mac]
选填 , 允许空值

如果管理的主机为裸机则需要填写,如果为虚拟机,则不需要。

Validations:

  • Must be String

host[architecture_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[domain_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[realm_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[puppet_proxy_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[puppetclass_ids]
选填 , 允许空值

Validations:

  • Must be an array of any type

host[operatingsystem_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be String

host[medium_id]
选填 , 允许空值

如果不是基于置备的映像,且用于管理主机,同时数值不是来自主机组,则需要填写。

Validations:

  • Must be String

host[ptable_id]
选填 , 允许空值

如果已管理主机,且未定义自定义分区,则需填写。

Validations:

  • Must be a number.

host[subnet_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[compute_resource_id]
选填 , 允许空值

nil 说明主机是裸机

Validations:

  • Must be a number.

host[root_pass]
选填 , 允许空值

如果已管理主机,且数值不是从主机组或设置中的默认密码继承,则需填写。

Validations:

  • Must be String

host[model_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[hostgroup_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[owner_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[owner_type]
选填 , 允许空值

主机拥有者类型

Validations:

  • Must be one of: User, Usergroup.

host[puppet_ca_proxy_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[image_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[host_parameters_attributes]
选填 , 允许空值

Host's parameters (array or indexed hash)

Validations:

  • Must be an Array of nested elements

host[host_parameters_attributes][name]
必填

Name of the parameter

Validations:

  • Must be String

host[host_parameters_attributes][value]
必填

Parameter value

Validations:

  • Must be String

host[build]
选填 , 允许空值

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[enabled]
选填 , 允许空值

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[provision_method]
选填 , 允许空值

The method used to provision the host. Possible provision_methods may be build (基本网络), image (基础介质)

Validations:

  • Must be String

host[managed]
选填 , 允许空值

用来表示主机被管理或没有被管理的 True/False 标签。注:这个值还决定是否需要一些参数。

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[progress_report_id]
选填 , 允许空值

用来跟踪复杂任务状态的 UUID,GET /api/orchestration/:UUID/tasks

Validations:

  • Must be String

host[comment]
选填 , 允许空值

本机附加信息

Validations:

  • Must be String

host[capabilities]
选填 , 允许空值

Validations:

  • Must be String

host[compute_profile_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[interfaces_attributes]
选填 , 允许空值

Host's network interfaces.

Validations:

  • Must be an Array of nested elements

host[interfaces_attributes][mac]
选填 , 允许空值

MAC address of interface. Required for managed interfaces on bare metal.

Validations:

  • Must be String

host[interfaces_attributes][ip]
选填 , 允许空值

接口 IP 地址

Validations:

  • Must be String

host[interfaces_attributes][type]
选填 , 允许空值

Interface type, e.g. bmc. Default is interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

host[interfaces_attributes][name]
选填 , 允许空值

Interface's DNS name

Validations:

  • Must be String

host[interfaces_attributes][subnet_id]
选填 , 允许空值

接口的 Foreman 子网 ID

Validations:

  • Must be Fixnum

host[interfaces_attributes][domain_id]
选填 , 允许空值

Foreman domain ID of interface. Required for primary interfaces on managed hosts.

Validations:

  • Must be Fixnum

host[interfaces_attributes][identifier]
选填 , 允许空值

设备标识符,例如:eth0 或者 eth1.1。

Validations:

  • Must be String

host[interfaces_attributes][managed]
选填 , 允许空值

这个接口应由 DHCP 管理还是由 DNS 智能代理服务器管理?是否应在配置过程中对其进行配置?

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][primary]
选填 , 允许空值

Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface.

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][provision]
选填 , 允许空值

Should this interface be used for TFTP of PXELinux (or SSH for image-based hosts)? Each managed hosts needs to have one provision interface.

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][username]
选填 , 允许空值

仅用于 BMC 接口

Validations:

  • Must be String

host[interfaces_attributes][password]
选填 , 允许空值

仅用于 BMC 接口

Validations:

  • Must be String

host[interfaces_attributes][provider]
选填 , 允许空值

结构提供者,例如 IPMI。仅用于 BMC 接口。

Validations:

  • Must be one of: IPMI.

host[interfaces_attributes][virtual]
选填 , 允许空值

别名或 VLAN 失败

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][tag]
选填 , 允许空值

VLAN 标签,这个属性优先于子网 VLAN ID。仅用于虚拟接口。

Validations:

  • Must be String

host[interfaces_attributes][attached_to]
选填 , 允许空值

这个接口所属接口识别符,例如:eth1。仅用于虚拟接口。

Validations:

  • Must be String

host[interfaces_attributes][mode]
选填 , 允许空值

接口的捆绑模式,例如:balance-rr。仅用于捆绑接口。

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

host[interfaces_attributes][attached_devices]
选填 , 允许空值

Identifiers of attached interfaces, e.g. `['eth1', 'eth2']`. For bond interfaces those are the slaves. Only for bond and bridges interfaces.

Validations:

  • Must be an array of any type

host[interfaces_attributes][bond_options]
选填 , 允许空值

空间分割选项,例如:miimon=100。仅用于捆绑接口。

Validations:

  • Must be String

host[interfaces_attributes][compute_attributes]
选填 , 允许空值

Additional compute resource specific attributes for the interface.

Validations:

  • Must be Hash

host[compute_attributes]
选填 , 允许空值

Additional compute resource specific attributes.

Validations:

  • Must be Hash


PUT /api/hosts/:id
更新主机

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

host
必填

Validations:

  • Must be a Hash

host[name]
选填

Validations:

  • Must be String

host[location_id]
选填

如果启用位置则需填写。

Validations:

  • Must be a number.

host[organization_id]
选填

如果启用机构则需要填写

Validations:

  • Must be a number.

host[environment_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be String

host[ip]
选填 , 允许空值

如果使用附带 DHCP 代理服务器的子网则不需要

Validations:

  • Must be String

host[mac]
选填 , 允许空值

如果管理的主机为裸机则需要填写,如果为虚拟机,则不需要。

Validations:

  • Must be String

host[architecture_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[domain_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[realm_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[puppet_proxy_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[puppetclass_ids]
选填 , 允许空值

Validations:

  • Must be an array of any type

host[operatingsystem_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be String

host[medium_id]
选填 , 允许空值

如果不是基于置备的映像,且用于管理主机,同时数值不是来自主机组,则需要填写。

Validations:

  • Must be String

host[ptable_id]
选填 , 允许空值

如果已管理主机,且未定义自定义分区,则需填写。

Validations:

  • Must be a number.

host[subnet_id]
选填 , 允许空值

如果已管理主机,且数值不是从主机组中继承,则需填写。

Validations:

  • Must be a number.

host[compute_resource_id]
选填 , 允许空值

nil 说明主机是裸机

Validations:

  • Must be a number.

host[root_pass]
选填 , 允许空值

如果已管理主机,且数值不是从主机组或设置中的默认密码继承,则需填写。

Validations:

  • Must be String

host[model_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[hostgroup_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[owner_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[owner_type]
选填 , 允许空值

主机拥有者类型

Validations:

  • Must be one of: User, Usergroup.

host[puppet_ca_proxy_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[image_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[host_parameters_attributes]
选填 , 允许空值

Host's parameters (array or indexed hash)

Validations:

  • Must be an Array of nested elements

host[host_parameters_attributes][name]
选填

Name of the parameter

Validations:

  • Must be String

host[host_parameters_attributes][value]
选填

Parameter value

Validations:

  • Must be String

host[build]
选填 , 允许空值

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[enabled]
选填 , 允许空值

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[provision_method]
选填 , 允许空值

The method used to provision the host. Possible provision_methods may be build (基本网络), image (基础介质)

Validations:

  • Must be String

host[managed]
选填 , 允许空值

用来表示主机被管理或没有被管理的 True/False 标签。注:这个值还决定是否需要一些参数。

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[progress_report_id]
选填 , 允许空值

用来跟踪复杂任务状态的 UUID,GET /api/orchestration/:UUID/tasks

Validations:

  • Must be String

host[comment]
选填 , 允许空值

本机附加信息

Validations:

  • Must be String

host[capabilities]
选填 , 允许空值

Validations:

  • Must be String

host[compute_profile_id]
选填 , 允许空值

Validations:

  • Must be a number.

host[interfaces_attributes]
选填 , 允许空值

Host's network interfaces.

Validations:

  • Must be an Array of nested elements

host[interfaces_attributes][mac]
选填 , 允许空值

MAC address of interface. Required for managed interfaces on bare metal.

Validations:

  • Must be String

host[interfaces_attributes][ip]
选填 , 允许空值

接口 IP 地址

Validations:

  • Must be String

host[interfaces_attributes][type]
选填 , 允许空值

Interface type, e.g. bmc. Default is interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

host[interfaces_attributes][name]
选填 , 允许空值

Interface's DNS name

Validations:

  • Must be String

host[interfaces_attributes][subnet_id]
选填 , 允许空值

接口的 Foreman 子网 ID

Validations:

  • Must be Fixnum

host[interfaces_attributes][domain_id]
选填 , 允许空值

Foreman domain ID of interface. Required for primary interfaces on managed hosts.

Validations:

  • Must be Fixnum

host[interfaces_attributes][identifier]
选填 , 允许空值

设备标识符,例如:eth0 或者 eth1.1。

Validations:

  • Must be String

host[interfaces_attributes][managed]
选填 , 允许空值

这个接口应由 DHCP 管理还是由 DNS 智能代理服务器管理?是否应在配置过程中对其进行配置?

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][primary]
选填 , 允许空值

Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface.

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][provision]
选填 , 允许空值

Should this interface be used for TFTP of PXELinux (or SSH for image-based hosts)? Each managed hosts needs to have one provision interface.

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][username]
选填 , 允许空值

仅用于 BMC 接口

Validations:

  • Must be String

host[interfaces_attributes][password]
选填 , 允许空值

仅用于 BMC 接口

Validations:

  • Must be String

host[interfaces_attributes][provider]
选填 , 允许空值

结构提供者,例如 IPMI。仅用于 BMC 接口。

Validations:

  • Must be one of: IPMI.

host[interfaces_attributes][virtual]
选填 , 允许空值

别名或 VLAN 失败

Validations:

  • Must be 'true' or 'false' or '1' or '0'

host[interfaces_attributes][tag]
选填 , 允许空值

VLAN 标签,这个属性优先于子网 VLAN ID。仅用于虚拟接口。

Validations:

  • Must be String

host[interfaces_attributes][attached_to]
选填 , 允许空值

这个接口所属接口识别符,例如:eth1。仅用于虚拟接口。

Validations:

  • Must be String

host[interfaces_attributes][mode]
选填 , 允许空值

接口的捆绑模式,例如:balance-rr。仅用于捆绑接口。

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

host[interfaces_attributes][attached_devices]
选填 , 允许空值

Identifiers of attached interfaces, e.g. `['eth1', 'eth2']`. For bond interfaces those are the slaves. Only for bond and bridges interfaces.

Validations:

  • Must be an array of any type

host[interfaces_attributes][bond_options]
选填 , 允许空值

空间分割选项,例如:miimon=100。仅用于捆绑接口。

Validations:

  • Must be String

host[interfaces_attributes][compute_attributes]
选填 , 允许空值

Additional compute resource specific attributes for the interface.

Validations:

  • Must be Hash

host[compute_attributes]
选填 , 允许空值

Additional compute resource specific attributes.

Validations:

  • Must be Hash


DELETE /api/hosts/:id
删除主机

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


GET /api/hosts/:id/status
Get configuration status of host

Return value may either be one of the following:

  • missing

  • failed

  • pending

  • changed

  • unchanged

  • unreported

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


GET /api/hosts/:id/status/:type
获取主机状态

Returns string representing a host status of a given type

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.

type
必填

status type, can be one of

  • global

  • configuration

  • build

Validations:

  • Must be one of: HostStatus::Global, configuration, build.


GET /api/hosts/:id/vm_compute_attributes
Get vm attributes of host

Return the host's compute attributes that can be used to create a clone of this VM

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


PUT /api/hosts/:id/puppetrun
强制在该主机值运行 Puppet 代理

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


PUT /api/hosts/:id/disassociate
取消该主机与 VM 的关联

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


PUT /api/hosts/:id/power
在主机中运行电源操作

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.

power_action
必填

电源操作,有效操作为 (on/start), (off/stop), (soft/reboot), (cycle/reset), (state/status)。

Validations:

  • Must be String


PUT /api/hosts/:id/boot
在指定设备引导主机

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.

device
必填

引导设备,有效设备为磁盘、光盘、pxe、bios。

Validations:

  • Must be String


POST /api/hosts/facts
上传主机详情,如需要,请创建主机。

参数

参数名字 描述
name
必填

主机的主机名

Validations:

  • Must be String

facts
必填

包含主机详情的哈希

Validations:

  • Must be Hash

certname
选填

自选:主机的证书名

Validations:

  • Must be String

type
选填

字算:要创建主机的 STI 类型

Validations:

  • Must be String


PUT /api/hosts/:id/rebuild_config
Rebuild orchestration config

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.


GET /api/hosts/:id/template/:kind
Preview rendered provisioning template content

参数

参数名字 描述
id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space.

kind
必填

Template kinds, available values:

Validations:

  • Must be String