Accessing rendered foreman template

Is there a way to access a rendered template outside of foreman/katello? I
setup a host that will never get built but is used to render out a KS. My
scenario is I want to use packer to build a vagrant box. I attempted to
access the KS via 8000 token based url but after a few attempts the URL was
no longer accessible. Does anyone have any suggestions for doing something
like this. I really don't want to host the kickstarts outside of katello
and have to maintain them twice if possible? Thanks!

Foreman 1.11 has a template preview API, available by doing "GET
/api/hosts/host.example.com/template/provision" with HTTP basic auth.
This would provide the rendered version of the template for any host
without needing a token or being subject to token expiry.

··· On 14/03/16 13:59, Travis Camechis wrote: > Is there a way to access a rendered template outside of foreman/katello? > I setup a host that will never get built but is used to render out a > KS. My scenario is I want to use packer to build a vagrant box. I > attempted to access the KS via 8000 token based url but after a few > attempts the URL was no longer accessible. Does anyone have any > suggestions for doing something like this. I really don't want to host > the kickstarts outside of katello and have to maintain them twice if > possible? Thanks!


Dominic Cleal
dominic@cleal.org

Yeah I think the problem is I can't really do any auth as I need to supply
the URL to the image just like do a real build, i.e. The url is passed
directly to the boot options starting the OS from the centos installer.

··· On Monday, March 14, 2016 at 10:24:47 AM UTC-4, Dominic Cleal wrote: > > On 14/03/16 13:59, Travis Camechis wrote: > > Is there a way to access a rendered template outside of foreman/katello? > > I setup a host that will never get built but is used to render out a > > KS. My scenario is I want to use packer to build a vagrant box. I > > attempted to access the KS via 8000 token based url but after a few > > attempts the URL was no longer accessible. Does anyone have any > > suggestions for doing something like this. I really don't want to host > > the kickstarts outside of katello and have to maintain them twice if > > possible? Thanks! > > Foreman 1.11 has a template preview API, available by doing "GET > /api/hosts/host.example.com/template/provision" with HTTP basic auth. > This would provide the rendered version of the template for any host > without needing a token or being subject to token expiry. > > -- > Dominic Cleal > dom...@cleal.org >

Consider using host group-based rendering instead, by associating the
template to a host group and environment, and setting OS details on the
template.

There is a small section on this at
TemplateWriting - Foreman.
Make sure you get all of the details listed set on the host group, else
it won't work.

Using host group rendering doesn't allow you to use DNS, DHCP and Puppet
CA orchestration features - but if you're building using an external
method, you're probably already aware.

··· On 14/03/16 14:38, Travis Camechis wrote: > Yeah I think the problem is I can't really do any auth as I need to > supply the URL to the image just like do a real build, i.e. The url is > passed directly to the boot options starting the OS from the centos > installer.


Dominic Cleal
dominic@cleal.org

I believe I actually have a hostgroup already setup correctly but I am
unclear on what the URL/port to use to hit this template?

··· On Monday, March 14, 2016 at 10:48:42 AM UTC-4, Dominic Cleal wrote: > > On 14/03/16 14:38, Travis Camechis wrote: > > Yeah I think the problem is I can't really do any auth as I need to > > supply the URL to the image just like do a real build, i.e. The url is > > passed directly to the boot options starting the OS from the centos > > installer. > > Consider using host group-based rendering instead, by associating the > template to a host group and environment, and setting OS details on the > template. > > There is a small section on this at > > http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Accessing-Templates. > > Make sure you get all of the details listed set on the host group, else > it won't work. > > Using host group rendering doesn't allow you to use DNS, DHCP and Puppet > CA orchestration features - but if you're building using an external > method, you're probably already aware. > > -- > Dominic Cleal > dom...@cleal.org >

"To access a template using a Hostgroup to render, simply use this URL:

/unattended/template/Template Name/Hostgroup Name

For example, a hostgroup of name Finance, and a template named
WebServerKickstart could be rendered using the url:

/unattended/template/WebServerKickstart/Finance"

··· -- Dominic Cleal dominic@cleal.org

On 14/03/16 18:43, Travis Camechis wrote:

I believe I actually have a hostgroup already setup correctly but I am
unclear on what the URL/port to use to hit this template?

On Monday, March 14, 2016 at 10:48:42 AM UTC-4, Dominic Cleal wrote:

On 14/03/16 14:38, Travis Camechis wrote:
> Yeah I think the problem is I can't really do any auth as I need to
> supply the URL to the image just like do a real build, i.e.  The
url is
> passed directly to the boot options starting the OS from the centos
> installer.

Consider using host group-based rendering instead, by associating the
template to a host group and environment, and setting OS details on the
template.

There is a small section on this at
http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Accessing-Templates
<http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Accessing-Templates>.

 Make sure you get all of the details listed set on the host group,
else
it won't work.

Using host group rendering doesn't allow you to use DNS, DHCP and
Puppet
CA orchestration features - but if you're building using an external
method, you're probably already aware.

-- 
Dominic Cleal
dom...@cleal.org <javascript:>


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
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto: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.

Yeah, thats what I was trying but only getting the sinatra page. Tried
port 8000 as well but it wasn't working. Should note I am using Katello
2.3/foreman 1.9

··· On Tuesday, March 15, 2016 at 4:08:50 AM UTC-4, Dominic Cleal wrote: > > "To access a template using a Hostgroup to render, simply use this URL: > > /unattended/template/Template Name/Hostgroup Name > > For example, a hostgroup of name Finance, and a template named > WebServerKickstart could be rendered using the url: > > /unattended/template/WebServerKickstart/Finance" > > -- > Dominic Cleal > dom...@cleal.org > > On 14/03/16 18:43, Travis Camechis wrote: > > I believe I actually have a hostgroup already setup correctly but I am > > unclear on what the URL/port to use to hit this template? > > > > On Monday, March 14, 2016 at 10:48:42 AM UTC-4, Dominic Cleal wrote: > > > > On 14/03/16 14:38, Travis Camechis wrote: > > > Yeah I think the problem is I can't really do any auth as I need > to > > > supply the URL to the image just like do a real build, i.e. The > > url is > > > passed directly to the boot options starting the OS from the > centos > > > installer. > > > > Consider using host group-based rendering instead, by associating > the > > template to a host group and environment, and setting OS details on > the > > template. > > > > There is a small section on this at > > > http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Accessing-Templates > > < > http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting#Accessing-Templates>. > > > > > Make sure you get all of the details listed set on the host group, > > else > > it won't work. > > > > Using host group rendering doesn't allow you to use DNS, DHCP and > > Puppet > > CA orchestration features - but if you're building using an external > > method, you're probably already aware. > > > > -- > > Dominic Cleal > > dom...@cleal.org > > > > -- > > 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-user...@googlegroups.com > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at https://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > > >

Provisioning templates should be accessed on port 80 on Foreman usually,
it sounds like you're trying to access the smart proxy.

··· On 15/03/16 13:29, Travis Camechis wrote: > Yeah, thats what I was trying but only getting the sinatra page. Tried > port 8000 as well but it wasn't working. Should note I am using Katello > 2.3/foreman 1.9


Dominic Cleal
dominic@cleal.org

https://katello/unattended/template/kickstartfile/hostgroup

··· On Tuesday, March 15, 2016 at 9:31:24 AM UTC-4, Dominic Cleal wrote: > > On 15/03/16 13:29, Travis Camechis wrote: > > Yeah, thats what I was trying but only getting the sinatra page. Tried > > port 8000 as well but it wasn't working. Should note I am using Katello > > 2.3/foreman 1.9 > > Provisioning templates should be accessed on port 80 on Foreman usually, > it sounds like you're trying to access the smart proxy. > > -- > Dominic Cleal > dom...@cleal.org >

thats the URL I am ussing and i get "Unattended Not Found error"

··· On Tuesday, March 15, 2016 at 11:55:08 AM UTC-4, Travis Camechis wrote: > > https://katello/unattended/template/kickstartfile/hostgroup > > On Tuesday, March 15, 2016 at 9:31:24 AM UTC-4, Dominic Cleal wrote: >> >> On 15/03/16 13:29, Travis Camechis wrote: >> > Yeah, thats what I was trying but only getting the sinatra page. Tried >> > port 8000 as well but it wasn't working. Should note I am using >> Katello >> > 2.3/foreman 1.9 >> >> Provisioning templates should be accessed on port 80 on Foreman usually, >> it sounds like you're trying to access the smart proxy. >> >> -- >> Dominic Cleal >> dom...@cleal.org >> >

You should probably use port 80 and HTTP, not HTTPS to access the
template. OS installers may not support HTTPS or be able to verify the
connection.

Also ensure that your provisioning template is called "kickstartfile"
and your host group is called "hostgroup". If you still have problems,
enable debug logging and pastebin /var/log/foreman/production.log during
the request.

Foreman :: Manual has
information on enabling debug. It would be best to enable the 'sql'
logger too.

··· On 15/03/16 15:55, Travis Camechis wrote: > https://katello/unattended/template/kickstartfile/hostgroup > > On Tuesday, March 15, 2016 at 9:31:24 AM UTC-4, Dominic Cleal wrote: > > On 15/03/16 13:29, Travis Camechis wrote: > > Yeah, thats what I was trying but only getting the sinatra page. > Tried > > port 8000 as well but it wasn't working. Should note I am using > Katello > > 2.3/foreman 1.9 > > Provisioning templates should be accessed on port 80 on Foreman > usually, > it sounds like you're trying to access the smart proxy. > > -- > Dominic Cleal > dom...@cleal.org > > -- > 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.


Dominic Cleal
dominic@cleal.org