Bug 2089339

Summary: please update Provisioning Guide (esp 7.8. Building a Discovery Image) for pulp3 usage
Product: Red Hat Satellite Reporter: Patrick C. F. Ernzer <pcfe>
Component: DocumentationAssignee: Malhar Jivrajani <mjivraja>
Documentation sub component: default QA Contact:
Status: CLOSED WONTFIX Docs Contact:
Severity: urgent    
Priority: urgent CC: lucas.blenkhorn, mdolezel, mjivraja, momran, saydas, zuansorg
Version: 6.10.0   
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-17 16:44:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Patrick C. F. Ernzer 2022-05-23 13:18:31 UTC
Document URL: https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html/provisioning_guide/configuring-the-discovery-service#building-a-discovery-image

Section Number and Name: 7.8. Building a Discovery Image

Describe the issue: provided instructions outdated.
we tell the user to consume
~~~
repo --name=rhel --baseurl=file:///var/lib/pulp/published/yum/https/repos/Default_Organization/Library/content/dist/rhel/server/7/7.7/x86_64
repo --name=sat --baseurl=file:///var/lib/pulp/published/yum/https/repos/Default_Organization/Library/content/dist/rhel/server/7/7Server/x86_64/sat-capsule/6.10/os
~~~

But with pulp3 these paths are no longer correct.

Comment 3 Malhar Jivrajani 2022-08-18 06:52:06 UTC
Link to the PR: https://github.com/theforeman/foreman-documentation/pull/1572

Comment 7 Sayan Das 2022-11-05 17:41:46 UTC
I have tested my suggested approach in Satellite 6.11.3 and 6.11.4 on RHEL 7:

** Install Discovery image and livecd-tools

# yum install foreman-discovery-image livecd-tools --disableplugin=foreman-protector 


** Enable the following repos in satellite UI.

# hammer --csv repository list --fields Id,Name | column -s, -t
Id  Name
5   Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.9
28  Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server
8   Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
11  Red Hat Satellite 6.11 for RHEL 7 Server RPMs x86_64
31  Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server


** Set their download policy to Immediate, and sync them.

** Once they are synced, export the repos in syncable way. [ this does not consumes additional space as it uses hardlinks of preexisting content ]

# hammer content-export complete repository --format syncable --id 5
[.................................................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_9-5/1.0/2022-11-04T17-49-32-01-00

# hammer content-export complete repository --format syncable --id 8
[.................................................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server-8/2.0/2022-11-04T17-50-00-01-00

# hammer content-export complete repository --format syncable --id 11
[.................................................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Org_1/Export-Red_Hat_Satellite_6_11_for_RHEL_7_Server_RPMs_x86_64-11/1.0/2022-11-04T18-51-00-01-00

# hammer content-export complete repository --format syncable --id 28
[.................................................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server-28/1.0/2022-11-05T15-24-05-01-00

# hammer content-export complete repository --format syncable --id 31
[.................................................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Org_1/Export-Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server-31/1.0/2022-11-05T17-58-38-01-00


** Setup the discovery kickstart:

# cd /usr/share/foreman-discovery-image
# cp -p foreman-discovery-image.ks foreman-discovery-image-custom.ks

# vi foreman-discovery-image-custom.ks

Replace the existing "repo --name" line and add these five exported repos at the top of the file in this way i.e. 

# head -5 foreman-discovery-image-custom.ks
repo --name=rhel --baseurl=file:///var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server-8/2.0/2022-11-04T17-50-00-01-00/content/dist/rhel/server/7/7Server/x86_64/os/
repo --name=kickstart --baseurl=file:///var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_9-5/1.0/2022-11-04T17-49-32-01-00/content/dist/rhel/server/7/7.9/x86_64/kickstart/
repo --name=sat --baseurl=file:///var/lib/pulp/exports/Org_1/Export-Red_Hat_Satellite_6_11_for_RHEL_7_Server_RPMs_x86_64-11/1.0/2022-11-04T18-51-00-01-00/content/dist/rhel/server/7/7Server/x86_64/satellite/6.11/os/
repo --name=optional --baseurl=file:///var/lib/pulp/exports/Org_1/Export-Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server-28/1.0/2022-11-05T15-24-05-01-00/content/dist/rhel/server/7/7Server/x86_64/optional/os/
repo --name=scl --baseurl=file:///var/lib/pulp/exports/Org_1/Export-Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server-31/1.0/2022-11-05T17-58-38-01-00/content/dist/rhel/server/7/7Server/x86_64/rhscl/1/os/


** Generate the ISO:

# livecd-creator --title="Discovery-Image" --compression-type=xz --cache=var/cache/build-fdi --config /usr/share/foreman-discovery-image/foreman-discovery-image-custom.ks --fslabel fdi --tmpdir /var/tmp

** Make it network-bootable:

# isohybrid --partok fdi.iso
# isohybrid --partok --uefi fdi.iso
# implantisomd5 fdi.iso


I have also tested by Discovering a VM using this new ISO and it works fine. 





Now, if we have to do a similar thing for Satellite 6.11.3+\ 6.12 on RHEL 8 OS to get a FDI build on RHEL 8, then in this exact same way, The following repos needs to be processed:

Red Hat Satellite 6.11 for RHEL 8 x86_64 RPMs
Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart 8.6
Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8.6
Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8
Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8

And then further synced, exported and mentioned in the kickstart file.

Since there are no livecd-creator present in RHEL 8 or above, lorax needs to be installed and "livemedia-creator" command needs to be used to build the image. 

But here the challenge :

A) We don't ship a el8\rhel-8 based discovery image or kickstart , neither in Sat 6.11 nor in upcoming sat 6.12 i.e. the files in /usr/share/foreman-discovery-image are RHEL 7 specific. 

B) Due to A, It's hard for the end user to figure out how and what exact changes they need to make in the kickstart for RHEL 8 based FDI. 

e.g. like including the module directives after the repos:

module --name=ruby --stream=2.7
module --name=postgresql --stream=12
module --name=foreman --stream=el8

and many more. 


C) We will also need to provide the full livemedia-creator command with correct options for the end-users to copy and execute.


So for FDI on a el8 version, either Sat eng team needs to be provide further instructions ( https://bugzilla.redhat.com/show_bug.cgi?id=1990875#c19 ) or else users need to be redirected to https://github.com/theforeman/foreman-discovery-image along with some instrcutions about how to use RHEL 8 repos instead of CentOS repos.