On 09/29, Bernard Landon wrote:
> Hello all!
>
> I am new to Foreman. So far I find it awsome :-)
> I find the documentation (especially the manual) is of very good quality
> :-) That's a nice change compared to other projects!
>
> I am trying to provision windows to bare metal and I got most of it working.
> I am just struggling on a silly thing. When writing a template, you may
> access the "parameters" defined in a host using @host.params["paramName"],
> but how would you do it for accessing parameters defined for an Operating
> System?
> I already tried a number of things but all failed :-( I have had an
> extensive look at the questions and doc but could not find a reference to
> this.

Have you tried this?

  <%= @host.params['your os parameter key'] %>

@host.params should contain parameters that come from all sources
associated with the host, including domain, operating system, subnet,
and hostgroup. I've just tried it and it worked on my Foreman.

Permissions-wise:

  Notice your user needs to either be an administrator, or have a role
  with a permission 'view_params' to be able to access these parameters.
  In addition to the 'view_params' permission, the user that wants to
  access these parameters needs to be able to have a permission to view
  the object (e.g 'view_operating_systems' and 'view_hosts')

You can use 'foreman-rake console' to experiment with this, the
templates are written in ERB which means you can write Ruby code in
between <%= %> tags.

>
> Also, more generally, what do  use to create template? Just the editor in
> foreman or others?

I normally just use the editor

>
> Thanks a lot!
>
> --
> 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+unsubscr...@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.


--
Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

-- 
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+unsubscr...@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.

Attachment: signature.asc
Description: PGP signature

Reply via email to