Provisioning "built" URL always points to foreman_url

Hi All,

I am using RHEL Satellite 6.1.6. I have a host that I am building using a
"host image" via the Capsule server. The host cannot see the Satellite
server directly as it is in the DMZ. However, there is a line in the
Provisioning Template which tells Satellite it is "built" which always
points to "foreman_url". What I need to know is how this line can be
dynamically modified so it points to the Capsule when it is being built
from the capsule? Extract from the template below.

Template
Inform the build system that we are done.
echo "Informing Satellite that we are built"
FOREMANSTRING="<%= foreman_url %>"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
<% end -%>
) 2>&1 | tee /root/install.post.log
exit 0

Template reviewed with real values
Inform the build system that we are done.
echo "Informing Satellite that we are built"
FOREMANSTRING="
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00
<http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00>
"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00
) 2>&1 | tee /root/install.post.log
exit 0

Thanks
Af

I noticed this too. The kickstart initially points at the Capsule, but the
final wget of the built token to complete the build process points at the
Satellite.

From a client's anaconda.cfg:

Use network installation

url --url="http://capsule
.example.com/pulp/repos/MyOrg/Library/content/dist/rhel/server/7/7.2/x86_64/kickstart/"

at the top of the file, but then:

wget -q -O /dev/null --no-check-certificate http://satellite
.example.com:80/unattended/built?token=BUILD-TOKEN-ID

at the end of the %post scripts.

I was going to write a %pre script to munge this wget FQDN to match the
FQDN used in the url line - unless it's a config issue in my Satellite?

D

··· On Thursday, 28 January 2016 09:56:23 UTC, puppetm...@gmail.com wrote: > > > Hi All, > > I am using RHEL Satellite 6.1.6. I have a host that I am building using a > "host image" via the Capsule server. The host cannot see the Satellite > server directly as it is in the DMZ. However, there is a line in the > Provisioning Template which tells Satellite it is "built" which always > points to "foreman_url". What I need to know is how this line can be > dynamically modified so it points to the Capsule when it is being built > from the capsule? Extract from the template below. > > ****Template**** > Inform the build system that we are done. > echo "Informing Satellite that we are built" > FOREMANSTRING="<%= *foreman_url* %>" > echo "The foreman string is: ${FOREMANSTRING}" > wget -q -O /dev/null --no-check-certificate <%= foreman_url %> > <% end -%> > ) 2>&1 | tee /root/install.post.log > exit 0 > > ****Template reviewed with real values**** > Inform the build system that we are done. > echo "Informing Satellite that we are built" > *FOREMANSTRING="* > *http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00* > > *"* > echo "The foreman string is: ${FOREMANSTRING}" > wget -q -O /dev/null --no-check-certificate > http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00 > ) 2>&1 | tee /root/install.post.log > exit 0 > > > Thanks > Af >

> From: puppetmoose500@gmail.com
> To: "Foreman users" <foreman-users@googlegroups.com>
> Sent: Thursday, January 28, 2016 10:53:32 AM
> Subject: [foreman-users] Provisioning "built" URL always points to foreman_url
>
>
>
> Hi All,
>
> I am using RHEL Satellite 6.1.6. I have a host that I am building using a
> "host image" via the Capsule server. The host cannot see the Satellite
> server directly as it is in the DMZ. However, there is a line in the
> Provisioning Template which tells Satellite it is "built" which always
> points to "foreman_url". What I need to know is how this line can be
> dynamically modified so it points to the Capsule when it is being built
> from the capsule? Extract from the template below.

If your smart proxy (capsule) has both the Templates and TFTP feature enabled, and the host
you're building the subnet in is pointing to that smart proxy as the TFTP server, it will
use the Capsule URL automatically.

I think this should work even if you're using image provisioning and not using the TFTP server,
although I haven't tested it.

··· ----- Original Message -----

Template
Inform the build system that we are done.
echo “Informing Satellite that we are built"
FOREMANSTRING=”<%= foreman_url %>"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
<% end -%>
) 2>&1 | tee /root/install.post.log
exit 0

Template reviewed with real values
Inform the build system that we are done.
echo "Informing Satellite that we are built"
FOREMANSTRING="
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00
"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00
) 2>&1 | tee /root/install.post.log
exit 0

Thanks
Af


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.

Thanks Stephen - We don't use TFTP but I have enabled it to test your
solution above. I also set the TFTP server to the capsule in the subnet
definition. Finally I redefined the host from scratch with the updated
settings. This has no impact to any of the provisioning template or
kickstart. Everything still points to the Satellite.

··· On Thursday, 28 January 2016 12:04:48 UTC, stephen wrote: > > > > > ----- Original Message ----- > > From: puppetm...@gmail.com > > To: "Foreman users" <forema...@googlegroups.com > > > Sent: Thursday, January 28, 2016 10:53:32 AM > > Subject: [foreman-users] Provisioning "built" URL always points to > foreman_url > > > > > > > > Hi All, > > > > I am using RHEL Satellite 6.1.6. I have a host that I am building using > a > > "host image" via the Capsule server. The host cannot see the Satellite > > server directly as it is in the DMZ. However, there is a line in the > > Provisioning Template which tells Satellite it is "built" which always > > points to "foreman_url". What I need to know is how this line can be > > dynamically modified so it points to the Capsule when it is being built > > from the capsule? Extract from the template below. > > If your smart proxy (capsule) has both the Templates and TFTP feature > enabled, and the host > you're building the subnet in is pointing to that smart proxy as the TFTP > server, it will > use the Capsule URL automatically. > > I think this should work even if you're using image provisioning and not > using the TFTP server, > although I haven't tested it. > > > > > ****Template**** > > Inform the build system that we are done. > > echo "Informing Satellite that we are built" > > FOREMANSTRING="<%= *foreman_url* %>" > > echo "The foreman string is: ${FOREMANSTRING}" > > wget -q -O /dev/null --no-check-certificate <%= foreman_url %> > > <% end -%> > > ) 2>&1 | tee /root/install.post.log > > exit 0 > > > > ****Template reviewed with real values**** > > Inform the build system that we are done. > > echo "Informing Satellite that we are built" > > *FOREMANSTRING="* > > * > http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00* > > < > http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00> > > > *"* > > echo "The foreman string is: ${FOREMANSTRING}" > > wget -q -O /dev/null --no-check-certificate > > > http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00 > > ) 2>&1 | tee /root/install.post.log > > exit 0 > > > > > > Thanks > > Af > > > > -- > > 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 . > > To post to this group, send email to forema...@googlegroups.com > . > > Visit this group at https://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > > >

Found a way to sort this - hope someone finds it useful:

  1. Enable "TFTP" and "templates" on the Capsule and restart foreman proxy:
    capsule-installer -v --templates true --tftp true
    systemctl restart foreman-proxy

  2. Infrastructure -> Subnets -> Choose subnet -> Capsules -> TFTP Capsule
    (set to capsule)

  3. Content -> Content Views -> Select Content view -> Add ( Add the
    kickstart repo for the OS version eg: Red Hat Enterprise Linux 7 Server
    Kickstart x86_64 7.2) -> Publish New version

  4. Hosts -> Operating Systems -> Choose OS -> Templates -> PXE Linux ->
    Select a template here

  5. Hosts -> All hosts -> New host
    -> Host -> Content View (select the correct content view)
    -> Network -> Subnet (choose the Subnet that has the capsule assigned)
    -> Operating System (the "Media" should be auto populated and greyed
    out when the Operating system is selected)

NB: IT SEEMS THE ISO AND TEMPLATES ARE ONLY RENDERED PROPERLY WHEN THE
HOST IS SET TO BE BUILT
(i.e. when the build button reads "cancel build").
Only download the ISO once the host is set to build state or the ISO image
"chain" line will read incorrectly. Hence:
-Once the build finishes the "Cancel Build" button will revert to "Build"
as expected.
-However, both the provisioning templates and iPXE templates will also
revert to show the satellite name instead of the capsule in certain places.
-When the "Build" button is selected and it displays "Cancel Build" the
templates will revert back to showing the capsule names again
-The ISO image will stay in line with the capsule names ONLY if the host
is set to build

··· On Friday, 29 January 2016 12:16:50 UTC, puppetm...@gmail.com wrote:

Thanks Stephen - We don’t use TFTP but I have enabled it to test your
solution above. I also set the TFTP server to the capsule in the subnet
definition. Finally I redefined the host from scratch with the updated
settings. This has no impact to any of the provisioning template or
kickstart. Everything still points to the Satellite.

On Thursday, 28 January 2016 12:04:48 UTC, stephen wrote:

----- Original Message -----

From: puppetm...@gmail.com
To: “Foreman users” forema...@googlegroups.com
Sent: Thursday, January 28, 2016 10:53:32 AM
Subject: [foreman-users] Provisioning “built” URL always points to
foreman_url

Hi All,

I am using RHEL Satellite 6.1.6. I have a host that I am building using
a
"host image" via the Capsule server. The host cannot see the Satellite
server directly as it is in the DMZ. However, there is a line in the
Provisioning Template which tells Satellite it is “built” which always
points to “foreman_url”. What I need to know is how this line can be
dynamically modified so it points to the Capsule when it is being built
from the capsule? Extract from the template below.

If your smart proxy (capsule) has both the Templates and TFTP feature
enabled, and the host
you’re building the subnet in is pointing to that smart proxy as the TFTP
server, it will
use the Capsule URL automatically.

I think this should work even if you’re using image provisioning and not
using the TFTP server,
although I haven’t tested it.

Template
Inform the build system that we are done.
echo “Informing Satellite that we are built"
FOREMANSTRING=”<%= foreman_url %>"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
<% end -%>
) 2>&1 | tee /root/install.post.log
exit 0

Template reviewed with real values
Inform the build system that we are done.
echo "Informing Satellite that we are built"
FOREMANSTRING="
*
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00*
<
http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00>

"
echo "The foreman string is: ${FOREMANSTRING}"
wget -q -O /dev/null --no-check-certificate

http://satellite1.domain.net:80/unattended/built?token=97ecf2a7-86bb-49ad-a6f2-10bacdab3f00

) 2>&1 | tee /root/install.post.log
exit 0

Thanks
Af


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.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.