Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions _includes/cloud-init_hostname.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#if $getVar("system_name","") != ""
#if $hostname != ""
hostname: $hostname
#else
#set $myhostname = $getVar('name','').replace("_","-")
hostname: $myhostname
#end if
#else
## profile based install so just provide one interface for starters
#set $myhostname = $getVar('hostname',$getVar('name','cobbler')).replace("_","-")
hostname: $myhostname
#end if
64 changes: 64 additions & 0 deletions _includes/cloud-init_network.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#if $getVar("system_name","") != ""
network:
ethernets:
#set ikeys = $interfaces.keys()
#import re
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
## Ignore BMC interface
#if $idata["interface_type"].lower() == "bmc"
#continue
#end if
#end for
#for $iname in $ikeys
#set $idata = $interfaces[$iname]
#set $mac = $idata["mac_address"]
#set $static = $idata["static"]
#set $ip = $idata["ip_address"]
#set $netmask = $idata["netmask"]
#set $type = $idata["interface_type"]
## Ignore BMC interface
#if $type == "bmc"
#continue
#end if
$iname:
match:
macaddress: $mac
#if $static == True:
#if $ip != "":
#if $netmask != "":
#set $mask = sum([bin(int(x)).count('1') for x in $netmask.split('.')])
dhcp4: false
addresses:
- $ip/$mask
#else
dhcp4: false
addresses:
- $ip/24
#end if
#if $gateway != "":
gateway4: $gateway
#end if
#if $name_servers and $name_servers[0] != "":
nameservers:
addresses:
#for $dns in $name_servers
- $dns
#end for
#end if
#else
dhcp4: true
#end if
#else
dhcp4: true
#end if
#end for
version: 2
#else
## profile based install so use DHCP
network:
ethernets:
eth0:
dhcp4: true
version: 2
#end if
44 changes: 44 additions & 0 deletions _includes/cloud-init_user-data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#cloud-config
autoinstall:
version: 1
apt:
preserve_sources_list: true
primary:
- arches: [amd64, i386]
uri: http://$http_server/cblr/links/$distro
## uri: http://us.archive.ubuntu.com/ubuntu
- arches: [default]
## uri: http://$http_server/cblr/links/$distro
uri: http://ports.ubuntu.com/ubuntu-ports
fallback: offline-install
identity:
$SNIPPET('cloud-init_hostname')
password: $default_password_crypted
realname: ubuntu
username: ubuntu
kernel:
package: linux-generic
keyboard:
layout: us
toggle: null
variant: ''
locale: en_US.UTF-8
$SNIPPET('cloud-init_network')
ssh:
allow-pw: true
install-server: true
storage:
layout:
name: lvm
sizing-policy: all
package_update: false
package_upgrade: false
late-commands:
## Figure out if we're automating OS installation for a system or a profile
#if $getVar('system_name','') != ''
#set $what = "system"
#else
#set $what = "profile"
#end if
- wget -O /target/tmp/autoinstall-user-data.yaml http://$http_server/cblr/svc/op/autoinstall/$what/$name
- chroot /target /bin/bash -s ssh-keygen -t rsa -b 2048 -m ssh2 -N "" -f /root/.ssh/id_rsa
9 changes: 9 additions & 0 deletions _includes/fix-ubuntu-profiles-GRUB_PXE.sh.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
for PROFILE in $(cobbler profile list); do
DIST=$(cobbler profile report --name $PROFILE | grep ^Distribution | awk {' print $3 '});
VER=$(cobbler distro report --name $DIST | grep "OS Version" | awk {' print $4 '});
[[ ($VER == "focal" || $VER == "jammy" || $VER == "noble") ]] || continue;
sed -i "s,auto-install/enable=true priority=critical netcfg/choose_interface=auto url=http://10.0.0.10/cblr/svc/op/autoinstall/profile/${PROFILE} hostname=.* domain=local.lan suite=${VER},," /var/lib/tftpboot/grub/x86_64_menu_items.cfg;
sed -i "s,auto-install/enable=true priority=critical netcfg/choose_interface=auto url=http://10.0.0.10/cblr/svc/op/autoinstall/profile/${PROFILE} hostname=.* domain=local.lan suite=${VER},," /var/lib/tftpboot/pxelinux.cfg/default;
DIST="" && VER="";
done
12 changes: 12 additions & 0 deletions _includes/fix-ubuntu-systems-GRUB_PXE.sh.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
for SYSTEM in $(cobbler system list); do
PROFILE=$(cobbler system report --name $SYSTEM | grep ^Profile | awk {' print $3 '})
DIST=$(cobbler profile report --name $PROFILE | grep ^Distribution | awk {' print $3 '});
VER=$(cobbler distro report --name $DIST | grep "OS Version" | awk {' print $4 '});
[[ ($VER == "focal" || $VER == "jammy" || $VER == "noble") ]] || continue;
MAC=$(cobbler system report --name $SYSTEM | grep "MAC Addr" | awk {' print $4 '})
sed -i "s,auto-install/enable=true priority=critical netcfg/choose_interface=auto url=http://10.0.0.10/cblr/svc/op/autoinstall/system/${SYSTEM} hostname=.* domain=local.lan suite=${VER},," /var/lib/tftpboot/grub/system/$MAC;
MAC=$(echo $MAC | sed 's,:,-,g');
sed -i "s,auto-install/enable=true priority=critical netcfg/choose_interface=auto url=http://10.0.0.10/cblr/svc/op/autoinstall/profile/${PROFILE} hostname=.* domain=local.lan suite=${VER},," /var/lib/tftpboot/pxelinux.cfg/01-$MAC;
PROFILE="" && DIST="" && VER="" && MAC="";
done
3 changes: 2 additions & 1 deletion _posts/2024/2024-11-12-Cobbler-v3.3.6-Beginners-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Install **VirtualBox VM Guest Additions**, either from the YUM repos, or the Gue
yum install virtualbox-guest-additions
```

### customizing
### Customizing

Install your preferred Linux sys admin tools and configure some convenient bash settings, for example *(PS1 variable controls bash shell prompt)*:

Expand Down Expand Up @@ -573,3 +573,4 @@ tftp 127.0.0.1
cat /etc/httpd/conf/httpd.conf
cat /etc/httpd/conf.d/cobbler.conf
```

Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Now the **PXE Client** should be able to boot from a generic/random MAC address
- [https://www.debian.org/distrib/netinst](https://www.debian.org/distrib/netinst)
- [https://www.debian.org/distrib/netinst#netboot](https://www.debian.org/distrib/netinst#netboot)
- [https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/MANIFEST](https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/MANIFEST)
- [https://wiki.debian.org/PXEBootInstall](https://wiki.debian.org/PXEBootInstall])
- [https://wiki.debian.org/PXEBootInstall](https://wiki.debian.org/PXEBootInstall)
- [https://wiki.debian.org/DebianInstaller](https://wiki.debian.org/DebianInstaller)
- [https://wiki.debian.org/DebianInstaller/NetbootFirmware](https://wiki.debian.org/DebianInstaller/NetbootFirmware)
- [https://wiki.debian.org/DebianInstaller/Preseed](https://wiki.debian.org/DebianInstaller/Preseed)
Expand Down Expand Up @@ -381,3 +381,4 @@ Now the **PXE Client** should be able to boot from a generic/random MAC address
- [https://debian-handbook.info/browse/wheezy/sect.package-authentication.html](https://debian-handbook.info/browse/wheezy/sect.package-authentication.html)
- [https://serverfault.com/questions/337278/debian-how-can-i-securely-get-debian-archive-keyring-so-that-i-can-do-an-apt-g](https://serverfault.com/questions/337278/debian-how-can-i-securely-get-debian-archive-keyring-so-that-i-can-do-an-apt-g)
- [https://ubuntuforums.org/archive/index.php/t-2217665.html](https://ubuntuforums.org/archive/index.php/t-2217665.html)

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Configure the Cobbler Profile to use the new autoinstall (`autoyast.xml`) templa
cobbler profile edit --name SUSE-15.6-x86_64 --autoinstall suse-15.6-autoyast.xml
```

Finally, create a new Cobbler System to automatically boot and install openSUSE Leap 15.6, replacing the *"aa:bb:cc:dd:ee:ff"* with the MAC address of your PXE client, being sure not to use a duplicate MAC or IP addresse of any other Cobbler System, and then sync up Cobbler, then sync up cobbler:
Finally, create a new Cobbler System to automatically boot and install openSUSE Leap 15.6, replacing the *"aa:bb:cc:dd:ee:ff"* with the MAC address of your PXE client, being sure not to use a duplicate MAC or IP addresse of any other Cobbler System, and then sync up Cobbler:

```shell
cobbler system add --name SUSE-15.6 --profile SUSE-15.6-x86_64 --netboot-enabled true --hostname SUSE-15-6 --interface eth0 --static true --mac-address "aa:bb:cc:dd:ee:ff" --ip-address 10.0.0.15 --gateway 10.0.0.1 --netmask 255.255.255.0 --name-servers "10.0.0.1 1.1.1.1 10.0.0.10"
Expand Down
Loading