GET /api/register
Render Global registration template

Examples

GET /register
200
echo "Default Global registration template"

Params

Param name Description
organization_id
optional

ID of the Organization to register the host in.

Validations:

  • Must be a number.

location_id
optional

ID of the Location to register the host in.

Validations:

  • Must be a number.

hostgroup_id
optional

ID of the Host group to register the host in.

Validations:

  • Must be a number.

operatingsystem_id
optional

ID of the Operating System to register the host in.

Validations:

  • Must be a number.

setup_insights
optional

Set ‘host_registration_insights’ parameter for the host. If it is set to true, insights client will be installed and registered on Red Hat family operating systems.

Validations:

  • Must be one of: true, false, 1, 0.

setup_remote_execution
optional

Set ‘host_registration_remote_execution’ parameter for the host. If it is set to true, SSH keys will be installed on the host.

Validations:

  • Must be one of: true, false, 1, 0.

packages
optional

Packages to install on the host when registered. Can be set by host_packages parameter. Example: pkg1 pkg2

Validations:

  • Must be a String

update_packages
optional

Update all packages on the host

Validations:

  • Must be one of: true, false, 1, 0.

repo
optional

Repository URL / details, for example for Debian OS family: ‘deb http://deb.example.com/ buster 1.0’, for Red Hat OS family: ‘http://yum.theforeman.org/client/latest/el8/x86_64/’

Validations:

  • Must be a String

repo_gpg_key_url
optional

URL of the GPG key for the repository

Validations:

  • Must be a String


POST /api/register
Find or create a host and render the 'Host initial configuration' template

Examples

POST /register
{
  "host": {
    "name": "hostgroup.example.com",
    "hostgroup_id": 636252244
  },
  "registration": {
    "host": {
      "name": "hostgroup.example.com",
      "hostgroup_id": 636252244
    }
  }
}
200
echo "Linux host initial configuration"

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

host
required

Validations:

  • Must be a Hash

host[name]
optional

Validations:

  • Must be a String

host[location_id]
optional

Validations:

  • Must be a number.

host[organization_id]
optional

Validations:

  • Must be a number.

host[ip]
optional , nil allowed

IPv4 address, not required if using a subnet with DHCP proxy

Validations:

  • Must be a String

host[ip6]
optional , nil allowed

IPv6 address, not required if using a subnet with DHCP proxy

Validations:

  • Must be a String

host[mac]
optional , nil allowed

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

Validations:

  • Must be a String

host[domain_id]
optional , nil allowed

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

Validations:

  • Must be a number.

host[operatingsystem_id]
optional , nil allowed

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

Validations:

  • Must be a number.

host[subnet_id]
optional , nil allowed

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

Validations:

  • Must be a number.

host[model_id]
optional , nil allowed

Validations:

  • Must be a number.

host[hostgroup_id]
optional , nil allowed

Validations:

  • Must be a number.

host[host_parameters_attributes]
optional , nil allowed

Host’s parameters (array or indexed hash)

Validations:

  • Must be an Array of nested elements

host[host_parameters_attributes][name]
optional

Name of the parameter

Validations:

  • Must be a String

host[host_parameters_attributes][value]
optional

Parameter value

Validations:

  • Must be a String

host[host_parameters_attributes][parameter_type]
optional , nil allowed

Type of value

Validations:

  • Must be one of: string, boolean, integer, real, array, hash, yaml, json.

host[host_parameters_attributes][hidden_value]
optional , nil allowed

Validations:

  • Must be one of: true, false, 1, 0.

host[build]
optional , nil allowed

Validations:

  • Must be one of: true, false, 1, 0.

host[enabled]
optional , nil allowed

Include this host within Foreman reporting

Validations:

  • Must be one of: true, false, 1, 0.

host[managed]
optional , nil allowed

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 one of: true, false, 1, 0.

host[comment]
optional , nil allowed

Additional information about this host

Validations:

  • Must be a String

host[interfaces_attributes]
optional , nil allowed

Host’s network interfaces.

Validations:

  • Must be an Array of nested elements

host[interfaces_attributes][mac]
optional , nil allowed

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

Validations:

  • Must be a String

host[interfaces_attributes][ip]
optional , nil allowed

IPv4 address of interface

Validations:

  • Must be a String

host[interfaces_attributes][ip6]
optional , nil allowed

IPv6 address of interface

Validations:

  • Must be a String

host[interfaces_attributes][type]
optional , nil allowed

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

Validations:

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

host[interfaces_attributes][name]
optional , nil allowed

Interface’s DNS name

Validations:

  • Must be a String

host[interfaces_attributes][subnet_id]
optional , nil allowed

Foreman subnet ID of IPv4 interface

Validations:

  • Must be a number.

host[interfaces_attributes][subnet6_id]
optional , nil allowed

Foreman subnet ID of IPv6 interface

Validations:

  • Must be a number.

host[interfaces_attributes][domain_id]
optional , nil allowed

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

Validations:

  • Must be a number.

host[interfaces_attributes][identifier]
optional , nil allowed

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

Validations:

  • Must be a String

host[interfaces_attributes][managed]
optional , nil allowed

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

Validations:

  • Must be one of: true, false, 1, 0.

host[interfaces_attributes][primary]
optional , nil allowed

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

Validations:

  • Must be one of: true, false, 1, 0.

host[interfaces_attributes][provision]
optional , nil allowed

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 one of: true, false, 1, 0.

host[interfaces_attributes][username]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

host[interfaces_attributes][password]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

host[interfaces_attributes][provider]
optional , nil allowed

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

Validations:

  • Must be one of: IPMI, Redfish, SSH.

host[interfaces_attributes][virtual]
optional , nil allowed

Alias or VLAN device

Validations:

  • Must be one of: true, false, 1, 0.

host[interfaces_attributes][tag]
optional , nil allowed

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

Validations:

  • Must be a String

host[interfaces_attributes][mtu]
optional , nil allowed

MTU, this attribute has precedence over the subnet MTU.

Validations:

  • Must be a Integer

host[interfaces_attributes][attached_to]
optional , nil allowed

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

Validations:

  • Must be a String

host[interfaces_attributes][mode]
optional , nil allowed

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]
optional , nil allowed

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]
optional , nil allowed

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

Validations:

  • Must be a String

host[interfaces_attributes][compute_attributes]
optional , nil allowed

Additional compute resource specific attributes for the interface.

Validations:

  • Must be a Hash

setup_insights
optional

Set ‘host_registration_insights’ parameter for the host. If it is set to true, insights client will be installed and registered on Red Hat family operating systems.

Validations:

  • Must be one of: true, false, 1, 0.

setup_remote_execution
optional

Set ‘host_registration_remote_execution’ parameter for the host. If it is set to true, SSH keys will be installed on the host.

Validations:

  • Must be one of: true, false, 1, 0.