fcarrus / RHVH-Provisioning-Satellite

How to do unattended provisioning of RHV Hypervisors using Satellite
3 stars 2 forks source link

Changes against upstream #1

Open lzap opened 4 years ago

lzap commented 4 years ago

For the record, here are changes against current upstream (summer 2020):

diff --git a/provisioning_templates/PXELinux/kickstart_ovirt_pxelinux.erb b/provisioning_templates/PXELinux/kickstart_ovirt_pxelinux.erb
index 9729ccf..724c9bd 100644
--- a/provisioning_templates/PXELinux/kickstart_ovirt_pxelinux.erb
+++ b/provisioning_templates/PXELinux/kickstart_ovirt_pxelinux.erb
@@ -1,14 +1,22 @@
 <%#
-kind: PXELinux
-name: Kickstart oVirt-RHVH PXELinux
+name: Baremetal Kickstart oVirt-RHVH PXELinux
+snippet: false
 model: ProvisioningTemplate
+kind: PXELinux
 oses:
-- oVirt
-- RHVH
+- RedHat
+%>
+<%# TODO: Manage bonds %>
+<%
+  subnet = @host.provision_interface.subnet
+  ip = @host.provision_interface.ip
+  mask = subnet.mask
+  gw = subnet.gateway
+  dns = subnet.dns_primary
 %>
 DEFAULT rhvh

 LABEL rhvh
 KERNEL <%= @kernel %>
-APPEND initrd=<%= @initrd %> inst.ks=<%= foreman_url("provision") %> inst.stage2=<%= medium_uri %> local_boot_trigger=<%= foreman_url("built") %> intel_iommu=on
+APPEND initrd=<%= @initrd %> inst.ks=<%= foreman_url("provision") %> inst.stage2=<%= medium_uri %> local_boot_trigger=<%= foreman_url("built") %> <%= subnet.dhcp ? '' : "ip=#{ip}::#{gw}:#{mask}:#{@host}::none nameserver=#{dns}" %> intel_iommu=on
 IPAPPEND 2
diff --git a/provisioning_templates/provision/kickstart_ovirt.erb b/provisioning_templates/provision/kickstart_ovirt.erb
index 40eb689..8ad3710 100644
--- a/provisioning_templates/provision/kickstart_ovirt.erb
+++ b/provisioning_templates/provision/kickstart_ovirt.erb
@@ -1,6 +1,6 @@
 <%#
 kind: provision
-name: Kickstart oVirt-RHVH
+name: Baremetal Kickstart oVirt-RHVH
 model: ProvisioningTemplate
 oses:
 - oVirt
@@ -36,8 +36,6 @@ view the host is assigned to. It's also possible to provide full url,
 in which case it would be used without a change.
 %>

-# This kickstart file was rendered from the Foreman provisioning template "<%= @template_name %>".
-
 install
 <%
 liveimg_name = host_param('liveimg_name') || 'squashfs.img'
@@ -50,13 +48,14 @@ end

 liveimg --url=<%= liveimg_url %>

-<% subnet = @host.subnet -%>
+<% prov_if = @host.provision_interface -%>
+<% subnet = prov_if.subnet -%>
 <% if subnet.respond_to?(:dhcp_boot_mode?) -%>
 <% dhcp = subnet.dhcp_boot_mode? && !@static -%>
 <% else -%>
 <% dhcp = !@static -%>
 <% end -%>
-network --bootproto <%= dhcp ? 'dhcp' : "static --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{subnet.dns_servers.join(',')}" %> --hostname <%= @host %> --device=<%= @host.mac -%>
+network --bootproto <%= dhcp ? 'dhcp' : "static --ip=#{prov_if.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{subnet.dns_servers.join(',')}" %> --hostname <%= @host %> --device=<%= prov_if.mac -%>

 rootpw --iscrypted <%= root_pass %>
 <% if host_param_true?('disable-firewall') -%>
@@ -76,6 +75,13 @@ reboot
 %post --log=/root/ks.post.log --erroronfail
 nodectl init
 <%= snippet 'redhat_register' %>
+
+<% if host_enc['parameters']['realm'] && @host.realm && (@host.realm.realm_type == 'FreeIPA' || @host.realm.realm_type == 'Red Hat Identity Management') -%>
+<%= snippet 'freeipa_register' %>
+<% end -%>
+
+<%= snippet('remote_execution_ssh_keys') %>
+
 <%= snippet 'kickstart_networking_setup' %>
 <%= snippet 'efibootmgr_netboot' %>
 /usr/sbin/ntpdate -sub <%= host_param('ntp-server') || '0.fedora.pool.ntp.org' %>

I am going to incorporate some of the changes, feel free to drop comments in the PR if you feel something is missing.

lzap commented 4 years ago

https://github.com/theforeman/community-templates/pull/737