Hi Guys,
I was wondering if it's possible to get the Datastore name of a VMware
compute profile configuration from a kickstart provisioning template.
I would like to do something like that:
if host_provider = "VMware" and datastore_name = dev_tier_1
do something
Is it possible? If yes, is it possible to list the information about disk
size and controllers ?
Regards,
Fernando
Hi Fernando,
It would be possible, let's go step by step.
To match the compute resource you would do:
<% if @host.provider == "VMware" %>
# Your kickstart VMware specific code
<% end %>
Matching the datastore is going to be possible, but complicated. Also
you would have to disable safemode rendering in Settings. I'm not
entirely sure right now of the syntax, but you should check the content
of @host.compute_attributes, and you will find the name of the datastore
volume there. So in the end it would be something like
<% @host.compute_attributes['volumes'].find { |volume| volume['datastore'] == 'dev_tier_1' } %>
Again, that is likely not the exact syntax because I don't know the
exact contents of compute_attributes['volumes'] for VMware, but
hopefully it gets you in the right direction.
There's a template writing guide in the wiki [1] that could be helpful
to you.
[1] TemplateWriting - Foreman
Best of luck, let us know if you need more information!
···
On 03/13, ffrodrigues2011@gmail.com wrote:
> Hi Guys,
>
> I was wondering if it's possible to get the Datastore name of a VMware
> compute profile configuration from a kickstart provisioning template.
>
> I would like to do something like that:
>
> if host_provider = "VMware" and datastore_name = dev_tier_1
> do something
>
> Is it possible? If yes, is it possible to list the information about disk
> size and controllers ?
>
> Regards,
>
> Fernando
>
>
>
>
> --
> 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/d/optout.
–
Daniel Lobato Garcia
@eLobatoss
blog.daniellobato.me
daniellobato.me
GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato
Hi Daniel,
Thank you for your help! 
It worked very well with <%= @host.provider %>. In my case, I can see
VMWare.
But I'm stuck in the @host.compute_attributes.
I tried to print the available options as I do with @host.params and
@host.os.media, but it returns nothing.
Regards,
Fernando
···
On Friday, March 13, 2015 at 3:33:04 PM UTC-4, ffrodri...@gmail.com wrote:
>
> Hi Guys,
>
> I was wondering if it's possible to get the Datastore name of a VMware
> compute profile configuration from a kickstart provisioning template.
>
> I would like to do something like that:
>
> if host_provider = "VMware" and datastore_name = dev_tier_1
> do something
>
> Is it possible? If yes, is it possible to list the information about disk
> size and controllers ?
>
> Regards,
>
> Fernando
>
>
>
>