After doing this, I was able to get my host past the PXE loader screen, it loads the Ubuntu22 installer but prompts for manual installation input. Hopefully I can pick up from here the rest of the autoinstaller setup
I was on the same boat, but Iāve managed to automatically install Ubuntu 20.04.4 and Ubuntu 22.04 using Foreman.
In your PXE/PXEGrub template (or whatever are you using to PXE boot), there should be something like ds=nocloud-net;s=some_url - Ubuntuās Autoinstall is looking for /meta-data, /user-data and /vendor-data files under this URL. In Foreman you can create the āUser data templateā (there should be āPreseed Autoinstall cloud-init user dataā in Foreman 3.3 installation you can use as a guidance). You can then point this URL to the http://foreman.example.com/userdata/ (your Foreman intallation) and Foreman should properly serve the correct templates for host under provisioning. Of course you need to properly assign this template for OS earlier for Foreman to know what to serve.
BTW, I donāt want to hijack this topic, but have a question related with the āuserdataā endpoint (if needed I can create a new topic) - what should serve these data? My understanding was that this should be job for Foreman Proxy (with installed templates plugin), but in my testing installation, when I query the proxy endpoint from the client, I get only meta-data (with hostname defined as proxy hostname), for user-data I get error 500. I get the proper files directly from the Foreman server.
But Iām totally new to Foreman (Iām currently trying to evaluate different solutions for mass deployment bare metal servers in our environment, for now the Foreman is winning ), so maybe I missed or misunderstood something.
Hey @dankowsk!
Foreman Smart Proxy doesnāt deliver the user-data templates because they are not available on the proxy (good point tho, would be nice if the proxy would have this capability). Therefore, it just forwards /userdata/ requests to the corresponding Foreman API. But, in order for this to work flawlessly, you gotta open port 8000 on the proxy and configure http forwarding as described in the orcharhino doc here.
Moreover, pay attention to your PXELinux template to reference the Proxy endpoint correctly. You have to use port 8000 on the Proxy, such that it forwards the request to your Foreman. The rendered template should look somehow like the following:
I would also recommend to put the iso image itself on the Smart Proxy as you can see in the url part (in case your host may not be able to communicate with your Foreman directly).
Keep in mind - this is only important if you wanna deploy via a Smart Proxy which may have a different subnet. If your host is directly connected to your Foreman, you donāt need to use port 8000 of your proxy since it can use the Foreman directly instead.
Let me know if this helps or if you have more questions!
@LeperMessiah what Foreman version are you referring to? Did you setup the userdata template and associate it with your operating system?
I would like to install Ubuntu 22.04 via Foreman as well.
Have a look at this discussion (especially at the end). It may help you too @ryle249.
Hey @gol19!
Youāre correct about the hardcoded debian part. Foreman 3.3 is not able to find the files in the Installation Media. Only with the latest foreman, there comes an exception for Ubuntu 22.04 which looks in the casper directory of the extracted image. You can solve this issue by creating a symbolic link accordingly.
The address you are referring is just an example: foreman.example.com is not a real address. Your pub directory should already be available at http://10.237.4.114/pub if thatās the IP of your Foreman. If it is not available, you sould also run into problems on other operating systems since they install the katello certificates from here. So, you gotta fix that first.
Is there a how-to with all the necessary steps to solve this problem?
I donāt get it. If I open Index of /ubuntu/dists/jammy/main/installer-amd64
I canāt find the new installer there is only a subfolder /legacy-images/ which is empty.
You can find all necessary steps with Foreman 3.4 documented here. In case you want to provision an Ubuntu 20.04.3+ host via a Smart Proxy, also pay attention to this.
Moreover, you should have a look at the provisioning templates. Especially the following two are important for Ubuntu 20.04.3+ deployment and must be associated in your Operating System configuration.
@bastian-src
I can not update to 3.4 as EL7 support is dropped with Foreman 3.4
(This problem should be solved at another time)
I switched the /usr/share/foreman/app/models/operatingsystems/debian.rb with your version from GitHub.
Then I added the preseed_default_pxelinux file you mentioned above.
But the VM will not start the installer the last step is:
HTTP://<hostname>/unattended/iPXE... ok
vsphere is complaining that VM is consuming too many CPU resources
In the template, I replaced the variables (KERNEL, INITRD, APPEND) with static values to make sure everything is fine. Then I downloaded the iso image, initrd and vmlinux manually.
All 3 links are working fine. Any idea what is missing?
Alright, reasonable. The debian.rb file change should be the most important commit for Ubuntu Autoinstall in Foreman 3.4.
It seems like your host tries to download the wrong boot template (it should use the previously mentioned PXELinux instead of some iPXE). What does your Operating System configuration in Foreman look like? Did you associate the template as I mentioned previously?
Can you maybe also provide a rendered version of your PXELinux template? After applying the commit, you shouldnāt adapt the KERNEL and INITRD paths anymore because Foreman detects them now. It recognizes the boot files in your installation media (in the /casper/) folder and downloads them to /var/lib/tftpboot/boot/<ubuntu-22-04-and-some-hash-code>-[initrd|vmlinuz]. The files might exist already from a previous run and you must delete them manually - otherwise, Foreman does not re-download them.
#
# This file was deployed via 'Preseed PXE 22.04' template
#
# Supported host/hostgroup parameters:
#
# blacklist = module1, module2
# Blacklisted kernel modules
#
# lang = en_US
# System locale
#
#
# WARNING
#
# Foreman will not download the kernel/initramdisk to PXE automatically. Please follow
# the official Ubuntu documentation and extract the files from the LiveCD (DVD) manually
# and optionally update the KERNEL and INITRD lines in this template.
#
DEFAULT linux cloud-init autoinstall
LABEL linux cloud-init autoinstall
KERNEL boot/ubuntu-local-repo-kddGAsOXrj4S-vmlinuz
INITRD boot/ubuntu-local-repo-kddGAsOXrj4S-initrd
APPEND ip=dhcp url=http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64.iso autoinstall root=/dev/ram0 ramdisk_size=1500000 fsck.mode=skip
I checked /var/lib/tftpboot/boot/ but both files:
ubuntu-local-repo-kddGAsOXrj4S-vmlinuz
ubuntu-local-repo-kddGAsOXrj4S-initrd
are missing.
I gotta admit, I didnāt use iPXE before and just PXELinux or PXEGrub2.
Is there any difference when you deploy the machine now? Is it still looking for iPXE?
Since your boot files are missing, I assume Foreman runs into an error when extracting these. Does the corresponding Installation Media point to your http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64?
Did you check /var/log/foreman/production.log? When you deploy your machine (e.g. click Build in foreman), there should appear some messages like the following:
<log time> Deploying TFTP PXELinux configuration for <host fqdn>
<log time> Skipping TFTP PXEGrub2 configuration for <host fqdn>
<log time> Skipping TFTP PXEGrub configuration for <host fqdn>
<log time> Skipping TFTP iPXE configuration for <host fqdn>
<log time> Fetching required TFTP boot files for <host fqdn>
At the time of the last command, there should also be something like this in your Smart Proxy (/var/log/foreman-proxy/proxy.log):
<log time> Started POST /tftp/fetch_boot_file
<log time> Started task /usr/bin/curl ... <installatio media path> ... </var/lib/tftpboot/boot/ubuntu-local-repo-kddGAsOXrj4S-vmlinuz>
<log time> Finished POST /tftp/fetch_boot_file
Regarding your template: It looks fine, despite the fact that you are missing this part from the original one (which I assume you left out on purpose for debugging). Without this, your machine is probably going to run into an error later on when the installer is actually booted - but letās see when we get there
HTTP://<MYPUPPETSERVER>unattended/iPXE... No such file or diectory
Yes, the directory http://<MYPUPPETSERVER>/pub/installation_media/ubuntu/22.04-x86_64
exists and I am able to download the iso with Firefox.
These are the lines from the log file
2022-11-29T10:18:48 [I|app|2f67287d] Started GET "/hosts/mynewhost.mydomain/review_before_build" for 10.10.4.55 at 2022-11-29 10:18:48 +0000
2022-11-29T10:18:48 [I|app|2f67287d] Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:51 [I|app|bd0d5371] Started PUT "/hosts/mynewhost.mydomain/setBuild?auth_object=mynewhost.mydomain&permission=build_hosts" for 10.10.4.55 at 2022-11-29 10:18:51 +0000
2022-11-29T10:18:51 [I|app|bd0d5371] Parameters: {"utf8"=>"ā", "authenticity_token"=>"NLxHAZO52h+9rns0ZGLR59v5KeAbQODbf0x50LpTY6ZBDFWUb3tLPfG2/oRJSYdzLUSF6obyYXwPbHpC29C/eA==", "host"=>{"build"=>"0"}, "commit"=>"Build", "auth_object"=>"mynewhost.mydomain", "permission"=>"build_hosts", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:51 [I|app|bd0d5371] Generating HOST ISO image for mynewhost.mydomain
2022-11-29T10:18:52 [I|app|bd0d5371] Uploading ISO image /tmp/d20221129-32435-2p4kkg/mynewhost.mydomain.iso for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Deploying TFTP PXELinux configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP PXEGrub2 configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP PXEGrub configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Skipping TFTP iPXE configuration for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Fetching required TFTP boot files for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Attaching ISO image to CDROM drive for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Delete the autosign entry for mynewhost.mydomain
2022-11-29T10:18:54 [I|app|bd0d5371] Remove puppet certificate for mynewhost.mydomain
2022-11-29T10:18:55 [I|app|bd0d5371] Adding autosign entry for mynewhost.mydomain
2022-11-29T10:18:55 [I|app|bd0d5371] Redirected to https://<MYPUPPETSERVER>/hosts/mynewhost.mydomain
2022-11-29T10:18:55 [I|app|3676db99] Started GET "/hosts/mynewhost.mydomain" for 10.10.4.55 at 2022-11-29 10:18:55 +0000
2022-11-29T10:18:55 [I|app|3676db99] Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|8351e5a2] Started GET "/hosts/mynewhost.mydomain/runtime?range=7" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|8351e5a2] Parameters: {"range"=>"7", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|bd279e09] Started GET "/hosts/mynewhost.mydomain/vm" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|ba4e2a67] Started GET "/hosts/mynewhost.mydomain/templates" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|8858b597] Started GET "/hosts/mynewhost.mydomain/overview" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|c824d9af] Started GET "/hosts/mynewhost.mydomain/nics" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|bfb08f45] Started GET "/hosts/mynewhost.mydomain/resources?range=7" for 10.10.4.55 at 2022-11-29 10:18:56 +0000
2022-11-29T10:18:56 [I|app|bd279e09] Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|ba4e2a67] Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|bfb08f45] Parameters: {"range"=>"7", "id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|8858b597] Parameters: {"id"=>"mynewhost.mydomain"}
2022-11-29T10:18:56 [I|app|c824d9af] Parameters: {"id"=>"mynewhost.mydomain"}
Itās weird to me that Foreman is still looking for an iPXE even tho you only set the PXELinux template. Especially, because the log you posted mentions that it deploys PXELinux and skips iPXE.
Can you also provide the Smart Proxy log (/var/log/foreman-proxy/proxy.log)? Did it contain the message I mentioned here?
Commenting on this:
Ok, so the directory exists, but does your Installation Media also contain that path? You should have an installation media configured like this:
And this must then be set in your Operating System configuration. According to this, your boot files are fetched and put in the corresponding tftpboot folder mentioned earlier.
Another think regarding the iPXE just came into my mind: When you deploy your host, do you set the PXE loader to PXELinux BIOS? It is in the Operating System tab.
The Installation Media is set on this page as well and must be the one I mentioned earlier (pointing to your local extracted iso in your pub directory)