Provisioning Kickscript

Hi,

Just realised I posted this in the puppet group and not the foreman group
thats probably got them confused. Have got foreman now booting and
building VM's but the kick script its sending to the booting machine is
blank, how do I edit this. We have a standard kick script we wont to use so
I can tailor that just need to know where to actually put it. The
provisioning template edit screen edits the PXEBoot config and gives it a
URL http://foreman/provisioning. So where is it picking it up from.

Thanks,

Richie.

Hosts resolve their templates based on the operating system selected
when you created it. So if you were setting it up from scratch, you'd:

a) add or edit a template under Provisioning Templates
(More>Provisioning) and select the kind as "provision". We ship
"Kickstart Default" templates which are a good starting point.

b) when editing the template, there's an "Association" tab at the top.
Make sure your operating system(s) is selected in this list.

c) edit the Operating System (More>Provisioning) and under the
"Templates" tab, select the provision template you created earlier.

d) now under the host edit page, on the "Operating System" tab there's a
Resolve button at the bottom, which allows you to confirm which template
the host will get when it requests the provision URL. You can also
preview the templates from the host view page, on the templates tab.

I go through this process on this screencast, you might find it useful
to watch: http://www.youtube.com/watch?v=eHjpZr3GB6s

··· On 13/06/13 08:57, Richie Rees wrote: > Hi, > > Just realised I posted this in the puppet group and not the foreman > group thats probably got them confused. Have got foreman now booting > and building VM's but the kick script its sending to the booting machine > is blank, how do I edit this. We have a standard kick script we wont to > use so I can tailor that just need to know where to actually put it. The > provisioning template edit screen edits the PXEBoot config and gives it > a URL http://foreman/provisioning. So where is it picking it up from.


Dominic Cleal
Red Hat Engineering

Thanks Dominic that solved my problem :slight_smile: Great video btw.

··· On Thursday, 13 June 2013 10:33:06 UTC+1, Dominic Cleal wrote: > > On 13/06/13 08:57, Richie Rees wrote: > > Hi, > > > > Just realised I posted this in the puppet group and not the foreman > > group thats probably got them confused. Have got foreman now booting > > and building VM's but the kick script its sending to the booting machine > > is blank, how do I edit this. We have a standard kick script we wont to > > use so I can tailor that just need to know where to actually put it. The > > provisioning template edit screen edits the PXEBoot config and gives it > > a URL http://foreman/provisioning. So where is it picking it up from. > > Hosts resolve their templates based on the operating system selected > when you created it. So if you were setting it up from scratch, you'd: > > a) add or edit a template under Provisioning Templates > (More>Provisioning) and select the kind as "provision". We ship > "Kickstart Default" templates which are a good starting point. > > b) when editing the template, there's an "Association" tab at the top. > Make sure your operating system(s) is selected in this list. > > c) edit the Operating System (More>Provisioning) and under the > "Templates" tab, select the provision template you created earlier. > > d) now under the host edit page, on the "Operating System" tab there's a > Resolve button at the bottom, which allows you to confirm which template > the host will get when it requests the provision URL. You can also > preview the templates from the host view page, on the templates tab. > > I go through this process on this screencast, you might find it useful > to watch: http://www.youtube.com/watch?v=eHjpZr3GB6s > > -- > Dominic Cleal > Red Hat Engineering >

Ok this still isn't working, have created my kick script assigned it to the
operation system. But still the url is blank.

··· On Thursday, 13 June 2013 10:57:56 UTC+1, Richie Rees wrote: > > Thanks Dominic that solved my problem :) Great video btw. > > On Thursday, 13 June 2013 10:33:06 UTC+1, Dominic Cleal wrote: >> >> On 13/06/13 08:57, Richie Rees wrote: >> > Hi, >> > >> > Just realised I posted this in the puppet group and not the foreman >> > group thats probably got them confused. Have got foreman now booting >> > and building VM's but the kick script its sending to the booting >> machine >> > is blank, how do I edit this. We have a standard kick script we wont to >> > use so I can tailor that just need to know where to actually put it. >> The >> > provisioning template edit screen edits the PXEBoot config and gives it >> > a URL http://foreman/provisioning. So where is it picking it up from. >> >> Hosts resolve their templates based on the operating system selected >> when you created it. So if you were setting it up from scratch, you'd: >> >> a) add or edit a template under Provisioning Templates >> (More>Provisioning) and select the kind as "provision". We ship >> "Kickstart Default" templates which are a good starting point. >> >> b) when editing the template, there's an "Association" tab at the top. >> Make sure your operating system(s) is selected in this list. >> >> c) edit the Operating System (More>Provisioning) and under the >> "Templates" tab, select the provision template you created earlier. >> >> d) now under the host edit page, on the "Operating System" tab there's a >> Resolve button at the bottom, which allows you to confirm which template >> the host will get when it requests the provision URL. You can also >> preview the templates from the host view page, on the templates tab. >> >> I go through this process on this screencast, you might find it useful >> to watch: http://www.youtube.com/watch?v=eHjpZr3GB6s >> >> -- >> Dominic Cleal >> Red Hat Engineering >> >

The contents of the URL change depending on where you access it from,
i.e. it identifies the source.

Have you tried previewing the template when logged into the UI? Is it
blank there?

When the host tries accessing it, look at Foreman's production.log file
and see what it says there.

··· On 13/06/13 11:39, Richie Rees wrote: > Ok this still isn't working, have created my kick script assigned it to > the operation system. But still the url is blank.


Dominic Cleal
Red Hat Engineering

Can see the template in the UI, but if i look in the apache logs I can see
a 404 error being given when the system tries to access the URL.

··· On Thursday, 13 June 2013 11:42:07 UTC+1, Dominic Cleal wrote: > > On 13/06/13 11:39, Richie Rees wrote: > > Ok this still isn't working, have created my kick script assigned it to > > the operation system. But still the url is blank. > > The contents of the URL change depending on where you access it from, > i.e. it identifies the source. > > Have you tried previewing the template when logged into the UI? Is it > blank there? > > When the host tries accessing it, look at Foreman's production.log file > and see what it says there. > > -- > Dominic Cleal > Red Hat Engineering >

From Production log

Started GET "/unattended/provision" for 172...* at Thu Jun 13 11:26:34
+0100 2013
Processing by UnattendedController#provision as HTML
Found tsghe02.phe.tsg.ts
Remove puppet certificate for tsghe02.phe.tsg.ts
Adding autosign entry for tsghe02.phe.tsg.ts
Rendered inline template (10.6ms)
Rendered text template (0.0ms)
Completed 500 Internal Server Error in 1342ms (Views: 9.6ms | ActiveRecord:
0.0ms)

··· On Thursday, 13 June 2013 12:08:02 UTC+1, Richie Rees wrote: > > Can see the template in the UI, but if i look in the apache logs I can see > a 404 error being given when the system tries to access the URL. > > On Thursday, 13 June 2013 11:42:07 UTC+1, Dominic Cleal wrote: >> >> On 13/06/13 11:39, Richie Rees wrote: >> > Ok this still isn't working, have created my kick script assigned it to >> > the operation system. But still the url is blank. >> >> The contents of the URL change depending on where you access it from, >> i.e. it identifies the source. >> >> Have you tried previewing the template when logged into the UI? Is it >> blank there? >> >> When the host tries accessing it, look at Foreman's production.log file >> and see what it says there. >> >> -- >> Dominic Cleal >> Red Hat Engineering >> >

Plot thickens if I goto the /unattend/provision?spoof-172...* i get

There was an error rendering the TEST template: regexp buffer overflow

··· On Thursday, 13 June 2013 12:10:42 UTC+1, Richie Rees wrote: > > From Production log > > Started GET "/unattended/provision" for 172.*.*.* at Thu Jun 13 11:26:34 > +0100 2013 > Processing by UnattendedController#provision as HTML > Found tsghe02.phe.tsg.ts > Remove puppet certificate for tsghe02.phe.tsg.ts > Adding autosign entry for tsghe02.phe.tsg.ts > Rendered inline template (10.6ms) > Rendered text template (0.0ms) > Completed 500 Internal Server Error in 1342ms (Views: 9.6ms | > ActiveRecord: 0.0ms) > > > On Thursday, 13 June 2013 12:08:02 UTC+1, Richie Rees wrote: >> >> Can see the template in the UI, but if i look in the apache logs I can >> see a 404 error being given when the system tries to access the URL. >> >> On Thursday, 13 June 2013 11:42:07 UTC+1, Dominic Cleal wrote: >>> >>> On 13/06/13 11:39, Richie Rees wrote: >>> > Ok this still isn't working, have created my kick script assigned it >>> to >>> > the operation system. But still the url is blank. >>> >>> The contents of the URL change depending on where you access it from, >>> i.e. it identifies the source. >>> >>> Have you tried previewing the template when logged into the UI? Is it >>> blank there? >>> >>> When the host tries accessing it, look at Foreman's production.log file >>> and see what it says there. >>> >>> -- >>> Dominic Cleal >>> Red Hat Engineering >>> >>

> Plot thickens if I goto the /unattend/provision?spoof-172...* i get
>
> There was an error rendering the TEST template: regexp buffer overflow

Ah, very useful clue. This is a problem on Ruby 1.8 and Foreman 1.1,
we've hopefully worked around it for 1.2.

It's caused by "safemode", which is designed to prevent malicious
Foreman users from adding code to provisioning templates which then
executes on the Foreman server. You can disable it in
>>>safemode_render, which should make the error
go away.

··· On 13/06/13 12:38, Richie Rees wrote:


Dominic Cleal
Red Hat Engineering

ALL FIXED…

Went through and removed comments and other junk left in the template, now
seems to be working :slight_smile:

··· On Thursday, 13 June 2013 12:43:03 UTC+1, Dominic Cleal wrote: > > On 13/06/13 12:38, Richie Rees wrote: > > Plot thickens if I goto the /unattend/provision?spoof-172.*.*.* i get > > > > There was an error rendering the TEST template: regexp buffer overflow > > Ah, very useful clue. This is a problem on Ruby 1.8 and Foreman 1.1, > we've hopefully worked around it for 1.2. > > It's caused by "safemode", which is designed to prevent malicious > Foreman users from adding code to provisioning templates which then > executes on the Foreman server. You can disable it in > >>>safemode_render, which should make the error > go away. > > -- > Dominic Cleal > Red Hat Engineering >