Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #38168 - Add hostname parameter to kickstart kernel params #10423

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

ShimShtein
Copy link
Member

This will force proper hostname during the installation phase

@waldirio
Copy link

Hey @ShimShtein

With your change, I was getting the same behavior/issue.

Please, let me share the change that was necessary to fix this issue.

diff --git a/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb b/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb
index bd5bad4..d999520 100644
--- a/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb
+++ b/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb
@@ -67,7 +67,7 @@ description: |
   end
   options.push("dualstack!") if subnet4 && subnet6
   if subnet4 && subnet4.dhcp_boot_mode?
-    options.push("ip=dhcp") if rhel_compatible && major >= 7
+    options.push("ip=::::#{hostname}::dhcp") if rhel_compatible && major >= 7
   elsif subnet4 && !subnet4.dhcp_boot_mode?
     if rhel_compatible && major < 7
       dns_servers = subnet4.dns_servers.join(',')

In anaconda documentation link, we can see the way to set the fqdn, when using dhcp

Technically all of the items are optional, so if you want to use dhcp but also set a hostname you can use ip=::::<hostname>::dhcp.

Thank you!
Waldirio

@ShimShtein ShimShtein force-pushed the add_hostname_to_kernel branch from 3ab2648 to 5bbec79 Compare January 30, 2025 11:40
@ShimShtein
Copy link
Member Author

Thanks @waldirio !
Fixed the PR to use the ip= field.

@stejskalleos stejskalleos self-assigned this Jan 31, 2025
@stejskalleos stejskalleos self-requested a review January 31, 2025 12:27
@@ -67,7 +67,7 @@ description: |
end
options.push("dualstack!") if subnet4 && subnet6
if subnet4 && subnet4.dhcp_boot_mode?
options.push("ip=dhcp") if rhel_compatible && major >= 7
options.push("ip=::::#{hostname}::dhcp") if rhel_compatible && major >= 7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself, from the docs:

Technically all of the items are optional, so if you want to use dhcp but also set a hostname you can use ip=::::::dhcp.

https://anaconda-installer.readthedocs.io/en/latest/boot-options.html

@shubhamsg199
Copy link

Tested this Patch, The provisioning is successful and only one host is created with provided hostname during host creation.

Copy link
Contributor

@stejskalleos stejskalleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍏 code LGTM & verified by QE, let's get this in.

@stejskalleos stejskalleos merged commit 495d2a3 into theforeman:develop Feb 13, 2025
31 checks passed
@stejskalleos
Copy link
Contributor

Thanks @ShimShtein @shubhamsg199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants