GET /api/hosts
List all hosts

GET /api/hostgroups/:hostgroup_id/hosts
List all hosts for a host group

GET /api/locations/:location_id/hosts
List hosts per location

GET /api/organizations/:organization_id/hosts
List hosts per organization

GET /api/environments/:environment_id/hosts
List hosts per environment

参数

参数名字 描述
hostgroup_id
选填

ID of host group

Validations:

  • Must be String

location_id
选填

ID of location

Validations:

  • Must be String

organization_id
选填

ID of organization

Validations:

  • Must be String

environment_id
选填

ID of environment

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
Show a host

参数

参数名字 描述
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
Create a host

参数

参数名字 描述
host
必填

Validations:

  • Must be a Hash

host[name]
必填

Validations:

  • Must be String

host[location_id]
必填

required if locations are enabled

Validations:

  • Must be a number.

host[organization_id]
必填

required if organizations are enabled

Validations:

  • Must be a number.

host[environment_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be String

host[ip]
选填 , 允许空值

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

Validations:

  • Must be String

host[mac]
选填 , 允许空值

required for managed host that is bare metal, not required if it's a virtual machine

Validations:

  • Must be String

host[architecture_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be a number.

host[domain_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

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]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be String

host[medium_id]
选填 , 允许空值

required if not imaged based provisioning and host is managed and value is not inherited from host group

Validations:

  • Must be String

host[ptable_id]
选填 , 允许空值

required if host is managed and custom partition has not been defined

Validations:

  • Must be a number.

host[subnet_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be a number.

host[compute_resource_id]
选填 , 允许空值

nil means host is bare metal

Validations:

  • Must be a number.

host[root_pass]
选填 , 允许空值

required if host is managed and value is not inherited from host group or default password in settings

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]
选填 , 允许空值

Host's 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 flag whether a host is managed or unmanaged. Note: this value also determines whether several parameters are required or not

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 address of interface

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 subnet ID of interface

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]
选填 , 允许空值

Device identifier, e.g. eth0 or eth1.1

Validations:

  • Must be String

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

Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?

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]
选填 , 允许空值

Only for BMC interfaces.

Validations:

  • Must be String

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

Only for BMC interfaces.

Validations:

  • Must be String

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

Interface provider, e.g. IPMI. Only for BMC interfaces.

Validations:

  • Must be one of: IPMI.

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

Alias or VLAN device

Validations:

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

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

VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces.

Validations:

  • Must be String

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

Identifier of the interface to which this interface belongs, e.g. eth1. Only for virtual interfaces.

Validations:

  • Must be String

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

Bond mode of the interface, e.g. balance-rr. Only for bond interfaces.

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]
选填 , 允许空值

Space separated options, e.g. miimon=100. Only for bond interfaces.

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
Update a host

参数

参数名字 描述
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]
选填

required if locations are enabled

Validations:

  • Must be a number.

host[organization_id]
选填

required if organizations are enabled

Validations:

  • Must be a number.

host[environment_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be String

host[ip]
选填 , 允许空值

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

Validations:

  • Must be String

host[mac]
选填 , 允许空值

required for managed host that is bare metal, not required if it's a virtual machine

Validations:

  • Must be String

host[architecture_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be a number.

host[domain_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

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]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be String

host[medium_id]
选填 , 允许空值

required if not imaged based provisioning and host is managed and value is not inherited from host group

Validations:

  • Must be String

host[ptable_id]
选填 , 允许空值

required if host is managed and custom partition has not been defined

Validations:

  • Must be a number.

host[subnet_id]
选填 , 允许空值

required if host is managed and value is not inherited from host group

Validations:

  • Must be a number.

host[compute_resource_id]
选填 , 允许空值

nil means host is bare metal

Validations:

  • Must be a number.

host[root_pass]
选填 , 允许空值

required if host is managed and value is not inherited from host group or default password in settings

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]
选填 , 允许空值

Host's 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 flag whether a host is managed or unmanaged. Note: this value also determines whether several parameters are required or not

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 address of interface

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 subnet ID of interface

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]
选填 , 允许空值

Device identifier, e.g. eth0 or eth1.1

Validations:

  • Must be String

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

Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?

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]
选填 , 允许空值

Only for BMC interfaces.

Validations:

  • Must be String

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

Only for BMC interfaces.

Validations:

  • Must be String

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

Interface provider, e.g. IPMI. Only for BMC interfaces.

Validations:

  • Must be one of: IPMI.

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

Alias or VLAN device

Validations:

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

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

VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces.

Validations:

  • Must be String

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

Identifier of the interface to which this interface belongs, e.g. eth1. Only for virtual interfaces.

Validations:

  • Must be String

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

Bond mode of the interface, e.g. balance-rr. Only for bond interfaces.

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]
选填 , 允许空值

Space separated options, e.g. miimon=100. Only for bond interfaces.

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
Delete a host

参数

参数名字 描述
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
Get status of host

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
Force a Puppet agent run on the host

参数

参数名字 描述
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
Disassociate the host from a 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
Run a power operation on host

参数

参数名字 描述
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
必填

power action, valid actions are (on/start), (off/stop), (soft/reboot), (cycle/reset), (state/status)

Validations:

  • Must be String


PUT /api/hosts/:id/boot
Boot host from specified device

参数

参数名字 描述
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
必填

boot device, valid devices are disk, cdrom, pxe, bios

Validations:

  • Must be String


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

参数

参数名字 描述
name
必填

hostname of the host

Validations:

  • Must be String

facts
必填

hash containing the facts for the host

Validations:

  • Must be Hash

certname
选填

optional: certname of the host

Validations:

  • Must be String

type
选填

optional: the STI type of host to create

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