Skip to content

foreman.php

Foreman integration module for retrieving infrastructure data such as OS lists, partitioning schemes, installation media, hostgroups, and network information.

API Methods

Method Action Description
get_hostgroup get hostgroups Returns suitable hostgroups for a specific location from Foreman.
get_media get installation media Returns suitable installation media for a specific OS from Foreman.
get_network get network info Returns Foreman's network ID for a specific IP address.
get_os get OS list Returns a list of available operating systems for the server's location.
get_ptable get partitioning table Returns suitable partitioning schemas for a specific OS from Foreman.

foreman/get_hostgroup

Returns suitable hostgroups for a specific location from Foreman.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_hostgroup
token ✅ string Authentication token.
id ✅ integer Server ID used to determine the location for hostgroups.

Request example

curl -s "https://invapi.hostkey.com/foreman.php" -X POST \
--data "action=get_hostgroup" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Success response example
{
"result": "OK",
"action": "get_hostgroup",
"data": [
{
"id": 10,
"name": "web-servers"
},
{
"id": 11,
"name": "db-cluster"
}
]
}
Error examples
{
"code": -1,
"message": "foreman/get_hostgroup: invalid server id"
}

foreman/get_media

Returns suitable installation media for a specific OS from Foreman.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_media
token ✅ string Authentication token.
id ✅ integer Server ID used for permission check and location retrieval.
os_id ✅ integer Operating system ID to fetch installation media for.

Request example

curl -s "https://invapi.hostkey.com/foreman.php" -X POST \
--data "action=get_media" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "os_id=VALUE"
Success response example
{
"result": "OK",
"action": "get_media",
"data": [
{
"id": 5,
"name": "ubuntu-22.04-lts"
},
{
"id": 8,
"name": "debian-11"
}
]
}
Error examples
{
"code": -1,
"message": "Foreman: invalid os_id."
}

foreman/get_network

Returns Foreman's network ID for a specific IP address.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_network
token ✅ string Authentication token.
id ✅ integer Server ID for permission check and location lookup.
ip ✅ string IP address to determine the network information.
network ✅ string Параметр network

Request example

curl -s "https://invapi.hostkey.com/foreman.php" -X POST \
--data "action=get_network" \
--data "token=VALUE" \
--data "id=VALUE" \
--data "ip=VALUE" \
--data "network=VALUE"
Success response example
{
"result": "OK",
"action": "get_network",
"data": [
{
"id": 102,
"name": "vlan-10-mgmt"
}
]
}
Error examples
{
"code": -1,
"message": "Foreman: invalid IP"
}

foreman/get_os

Returns a list of available operating systems for the server's location.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_os
token ✅ string Authentication token.
id ✅ integer Server ID used to determine the location for OS list retrieval.

Request example

curl -s "https://invapi.hostkey.com/foreman.php" -X POST \
--data "action=get_os" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Success response example
{
"result": "OK",
"action": "get_os",
"data": [
{
"id": 1,
"name": "CentOS 7"
},
{
"id": 2,
"name": "Ubuntu 20.04"
}
]
}
Error examples
{
"code": -1,
"message": "foreman/get_os: invalid server id"
}

foreman/get_ptable

Returns suitable partitioning schemas for a specific OS from Foreman.

HTTP method: POST

Parameters:

Parameter Required Type Description
action ✅ string Method identifier: get_ptable
token ✅ string Authentication token.
id ✅ integer Server ID used for permission check and location retrieval.
os_id ✅ integer Operating system ID to fetch partitioning schemas.

Request example

curl -s "https://invapi.hostkey.com/foreman.php" -X POST \
--data "action=get_ptable" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "os_id=VALUE"
Success response example
{
"result": "OK",
"action": "get_ptable",
"data": [
{
"id": 50,
"name": "standard-lvm"
},
{
"id": 51,
"name": "raid-setup"
}
]
}
Error examples
{
"code": -1,
"message": "Foreman: invalid os_id."
}
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×