Register Agent with Director Self-Service API for existing Host AND change assigned Template

Hi,

I would like to use some kind of a “two step” Migration from a legacy monitoring system to an icinga2 based one.

Step 1: import all hosts and associate them with a “ping-only” host template
- fiddle around with custom attributes, grouping etc.
- hosts don’t have a self-service key!

Step 2: Rollout Agents
- agents will be installed using self-service API
- using self-service API Key for host-template to be used from now on

The problem I am struggling with:

Step 2 works like charm - except: the Host-Template associated with the used Self-Service API key gets not assigned to the already existing host.

What I would like to accomplish is:

During agent-installation the template of a host does change to the one denoted by the Self-Service API key - even if there is already a template on a host.

Maybe I can use an API-Call after registration to change the template - but this needs to use Self-Service API & Templatename during installation - and I hoped to just somehow could use one parameter only: key or template name.

Is there any “short” way to accomplish this?

Thx!