Foreman templates

Hi guys,

Is there a way how to dynamically generate primary interface name from
kickstart template?
@host.interfaces array doesn't include first interface. This would be handy
with RH7 and interface name change. On 1.7.2-1 version I tried
@host.facts['interface'] plus split and print first element of array it
works only if I click on Host -> Templates -> provision Template -> review
. When in build mode it's gone because all facts are gone too.
Any other possibility?

Thank you,

Marek

Hello,

I'm afraid there's no reliable way. In Foreman 1.7.* primary interface is part
of host object and the information we store there is limited. You can try
@host.primary_interface which is a host attribute that stores identifier of
primary interface based on facts. But if it's a new host without any facts
uploaded this will be nil.

In Foreman 1.8 (and current nightly) primary interface is extracted from host
and is a normal interface so you can set the identifier and all other
attributes before provisioning.

Hope this helps a bit

··· -- Marek

On Wednesday 11 of February 2015 14:53:18 marek ciganek wrote:

Hi guys,

Is there a way how to dynamically generate primary interface name from
kickstart template?
@host.interfaces array doesn’t include first interface. This would be handy
with RH7 and interface name change. On 1.7.2-1 version I tried
@host.facts[‘interface’] plus split and print first element of array it
works only if I click on Host -> Templates -> provision Template -> review
. When in build mode it’s gone because all facts are gone too.
Any other possibility?

Thank you,

Marek