Smart Variables matcher for subnet

Hi List !

I am trying to create a custom Smart Variable that will provide a Default
value, but I would like to override it with another value IF the host
belongs to a specific subnet. So I need to find the right matcher for
subnet. Eg should a host has the ip address 10.48.54.14/22

NETMASK=255.255.252.0
BROADCAST=10.48.55.255
NETWORK=10.48.52.0 —> this is the matcher looking for.

I have tried subnet=10.48.52.0 but it doesn't pickup between the objects in
the Order list, even though I added it there.

subnet
fqdn
hostgroup
os
domain

Are you aware of the name that needs to be there ? Perhaps
subnet is a non existent Variable. Mr foreman version in 1.7

Best regards,

Nikos

The matcher currently uses the subnet name, network address and CIDR
prefix as defined in Foreman. So if your subnet name was "Production",
use a matcher of:

subnet=Production (10.48.52.0/22)

This will be changed in 1.13.0 to use the subnet name only.

Ensure the host's network interfaces have the subnet set, they won't
have it set automatically during fact imports.

··· On 04/07/16 12:54, Nikos Zaharioudakis wrote: > Hi List ! > > I am trying to create a custom Smart Variable that will provide a > Default value, but I would like to override it with another value IF the > host belongs to a specific subnet. So I need to find the right matcher > for subnet. Eg should a host has the ip address 10.48.54.14/22 > > > NETMASK=255.255.252.0 > BROADCAST=10.48.55.255 > NETWORK=10.48.52.0 ---> this is the matcher looking for.


Dominic Cleal
dominic@cleal.org

I don't think subnet will work, but i'm not really sure. Maybe someone else
can advise

You might be better off use has_ip_network in Puppet stdlibs [1] ?
Obviously you'll need to edit the Puppet class every time you want to
change the logic though.

[1] https://forge.puppet.com/puppetlabs/stdlib/readme#has_ip_network

Sean

··· On Mon, Jul 4, 2016 at 12:54 PM, Nikos Zaharioudakis wrote:

Hi List !

I am trying to create a custom Smart Variable that will provide a Default
value, but I would like to override it with another value IF the host
belongs to a specific subnet. So I need to find the right matcher for
subnet. Eg should a host has the ip address 10.48.54.14/22

NETMASK=255.255.252.0
BROADCAST=10.48.55.255
NETWORK=10.48.52.0 —> this is the matcher looking for.

I have tried subnet=10.48.52.0 but it doesn’t pickup between the objects
in the Order list, even though I added it there.

subnet
fqdn
hostgroup
os
domain

Are you aware of the name that needs to be there ? Perhaps
subnet is a non existent Variable. Mr foreman version in 1.7

Best regards,

Nikos


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

> > Hi List !
> >
> > I am trying to create a custom Smart Variable that will provide a
> > Default value, but I would like to override it with another value IF the
> > host belongs to a specific subnet. So I need to find the right matcher
> > for subnet. Eg should a host has the ip address 10.48.54.14/22
> > <http://10.48.54.14/22>
> >
> > NETMASK=255.255.252.0
> > BROADCAST=10.48.55.255
> > NETWORK=10.48.52.0 —> this is the matcher looking for.
>
> The matcher currently uses the subnet name, network address and CIDR
> prefix as defined in Foreman. So if your subnet name was "Production",
> use a matcher of:
>
> subnet=Production (10.48.52.0/22)
>
> This will be changed in 1.13.0 to use the subnet name only.
>
> Ensure the host's network interfaces have the subnet set, they won't
> have it set automatically during fact imports.
>
> –
> Dominic Cleal
> dominic@cleal.org
>
>
Dear Dominic,

You nailed it. The thing is that we could clarify it a bit more in the docs
(or at least I didn't get it).In addition, in the bug
Bug #5785: Override class parameter by subnet no longer works since 1.5 - Foreman the formatting of the page,
doesn't help to get it at once

Thanks a lot for your prompt reply.

Nikos

··· On Mon, Jul 4, 2016 at 3:11 PM Dominic Cleal wrote: > On 04/07/16 12:54, Nikos Zaharioudakis wrote:


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.