Global Registration - New workflow
Updated WF for registering host via Global Registration template
and Host Registration Template without SmartProxy.
The registration workflow implemented by a pair of new API endpoints.
The first endpoint allows user to get the Global Registration Template (GRT),
which contains generic instructions for any new machine. User must specify
OS or hostgroup, that will determine OS for registered host. Also organization
and location parameters are mandatory. The global registration template is
set through an application setting. The GRT renders to a script that should
be executed on the registered machine in order to create the Host record
and fetch the Host Registration Template (HRT).
The second endpoint allows a creation of the Host object. If it succeeds, the
HRT template is rendered. HRT includes bootstrap steps specific to the host.
These can be adjusted based on parameters inherit from OS, subnet, domain,
host group or set for the host itself.
The second endpoint does not allow to specify all host parameters, e.g. owner_id
and owner_type so that user can't create host outside of his or her allowed scope.
Also compute resource parameters could case issues, e.g. trying to create a VM
on the hypervisor, where it already exists. Acceptable parameters are enforced
via strong parameters definition in the registration controller.
Both endpoints return the script to be executed, even in case of error. They are
expected to be piped to the bash (or other shell), so e.g. 404 prints the error using
Host owner is always set to the user, who performs the registration, to avoid any
possibility of assigning the host to an organization or location, who the original
user does not have access to.
The defaut HRT contains instructions on how to setup REX keys and install insights
agent if applicable. This can be overriden by using Parameters. The default value
is seeded as a Global parameter.