Project

General

Profile

Actions

Bug #31296

open

Document host import from compute resource via API

Added by Anton Nesterov about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
easy
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

I figured that it's possible to use POST to /api/hosts endpoint to import hosts from a compute resource.

{"host": {"compute_resource_id": 1, "uuid": "e6cd2ca9-312b-4b35-809c-84ac72c5f182", "hostgroup_id": 3, "location_id": 2, "organization_id": 1}}

The UUID can be taken from e.g. /api/compute_resources/:id/available_virtual_machines, so all the bits are in place.
What's lacking is at least the documentation for the uuid parameter in the hosts endpoint. Ideally there could be a more self-descriptive endpoint similar to PUT /api/compute_resources/:id/associate for the import function, which aliases the /api/hosts if that's even possible.

Where I want to go with this is an ansible module for importing hosts for foreman-ansible-modules.

Somewhat similar to this https://projects.theforeman.org/issues/27090


Related issues 1 (1 open0 closed)

Related to Foreman - Tracker #27680: API bugs that need workarounds in foreman-ansible-modulesNew

Actions
Actions

Also available in: Atom PDF