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)
@bastian-src sorry for the delay.
In this network is no DHCP relay/server available. I am not sure if we can use pxe in this case.
Nevertheless, I changed the PXE loader from ‘none’ to ‘PXELinux BIOS’
HTTP://<MYPUPPETSERVER>/unattended/iPXE... No such file or directory.
/var/log/foreman-proxy/proxy.log
2022-12-06T10:39:25 8edda413 [I] Started POST /puppet/ca/autosign/<myhost>
2022-12-06T10:39:25 8edda413 [I] Finished POST /puppet/ca/autosign/<myhost> with 200 (0.63 ms)
No worries regarding the delay, I do also need some time!
Your Installation Media path is configured wrong. As described in the docs here: Provisioning Hosts, it says
Use http://foreman.example.com/pub/installation_media/ubuntu/22.04-x86_64/ to set up your installation media entry in Foreman.
Accordingly, you should have the iso image here http://<MYSERVER>/pub/installation_media/ubuntu/22.04-x86_64.iso (as you mentioned you already did this) and the extracted image right next to it here http://<MYSERVER>/pub/installation_media/ubuntu/22.04-x86_64/.
The Installation Media path must point to the extracted folder, not just it’s parent [...]/ubuntu as it is currently the case in your configuration.
I’m not sure about using PXE without a DHCP server - so, if you are confident that iPXE sould to the job here - go for it. Just keep in mind to set the autoinstall boot parameters in the iPXE template as well. You should be able to easily “migrate” them from the PXELinux Autoinstall template.
Regarding your proxy log file: The snippet you sent does not contain the API call which is important for the boot file download. Re-run the host deployment with the updated Installation Media path, as I mentioned earlier, check whether the boot files are now downloaded to /var/lib/tftpboot/boot/, and have a look at your Smart Proxy log for a POST request to tftp/fetch_boot_file. It could be interesting to see that.