Subnet in CIDR notation in template

Hi

In a provisioning template, I would like to use the subnet in cidr notation
(For example '10.9.6.0/24' ) by using the information provided by the
@interfaces array. (<%= @host.interfaces.first.subnet… %>).

For my use case (the provisioning of ESXi hypervisors) ,I could solve the
problem by defining the cidr address as a hostgroup variable, but
rendering based on the subnet information that is available in
foreman would certainly be a better solution.

Does someone have a suggestion ?

Thanks in advance

Herwig

Thanks, Ohad

in fact the following does exactly what I want:

<%= @host.interfaces.first.subnet.network %>/<%=
@host.interfaces.first.subnet.cidr %>

Best regards

Herwig

··· On Thursday, February 20, 2014 3:25:27 PM UTC+1, Herwig Bogaert wrote: > > Hi > > In a provisioning template, I would like to use the subnet in cidr > notation (For example '10.9.6.0/24' ) by using the information provided > by the @interfaces array. (<%= @host.interfaces.first.subnet.... %>). > > For my use case (the provisioning of ESXi hypervisors) ,I could solve the > problem by defining the cidr address as a hostgroup variable, but > rendering based on the subnet information that is available in > foreman would certainly be a better solution. > > Does someone have a suggestion ? > > Thanks in advance > > Herwig >

> Hi
>
> In a provisioning template, I would like to use the subnet in cidr
> notation (For example '10.9.6.0/24' ) by using the information provided
> by the @interfaces array. (<%= @host.interfaces.first.subnet… %>).
>
> For my use case (the provisioning of ESXi hypervisors) ,I could solve the
> problem by defining the cidr address as a hostgroup variable, but
> rendering based on the subnet information that is available in
> foreman would certainly be a better solution.
>
> Does someone have a suggestion ?
>

how about
<% @host.interfaces.each do |i| %>
<%= i.subnet.cidr %>
<% end %>

··· On Thu, Feb 20, 2014 at 4:25 PM, Herwig Bogaert wrote:

Thanks in advance

Herwig


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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.