Skip to content
Open
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ package-lock.json
/docker/secrets/*
!/docker/secrets/.keep

# Local Cobbler distro source tree bind-mounted into cobblerd/http-api (see compose.common.yaml
# and docker/orthos/setup_fake_cobbler_distro.py)
/distro-sources/


# Ignore AI stuff
.github/instructions/codacy.instructions.md
.claude
332 changes: 319 additions & 13 deletions compose.common.yaml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions docker/cobbler/cobbler-startup.sh

This file was deleted.

9 changes: 0 additions & 9 deletions docker/cobbler/cobbler.dockerfile

This file was deleted.

173 changes: 173 additions & 0 deletions docker/orthos/cobbler-templates/dhcp.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# ************************************************************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from Cobbler dhcp.conf template ($date)
# Do NOT make changes to this file! Instead, make your changes inside the template, as /etc/dhcpd.conf will be
# overwritten.
#
# Adapted from Cobbler's built-in cheetah/etc/dhcp.template (see cobbler/data/templates/cheetah/etc/dhcp.template
# in the Cobbler repo) - only the "subnet" block below was changed, to the "192.0.2.0/24" network used by the
# orthos2 dev stack, registered as the active "dhcpv4" template via docker/orthos/setup_cobbler_dhcp_templates.py.
# ************************************************************************************************************

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option system-arch code 93 = unsigned integer 16;

subnet 192.0.2.0 netmask 255.255.255.0 {
option routers 192.0.2.1;
option domain-name-servers 192.0.2.1;
option domain-name "orthos2.test";
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.0.2.100 192.0.2.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server_v4;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

# Legacy
if option system-arch = 00:00 {
filename "grub/grub.0";
}
# UEFI-32-1
if option system-arch = 00:06 {
# Not supported, no 32 bit UEFI grub executable
filename "unsupported";
}
# UEFI-32-2
if option system-arch = 00:02 {
# Not supported, no 32 bit UEFI grub executable
filename "unsupported";
}
# UEFI-64-1
else if option system-arch = 00:07 {
filename "grub/grubx64.efi";
}
# UEFI-64-2
else if option system-arch = 00:08 {
filename "grub/grubx64.efi";
}
# UEFI-64-3
else if option system-arch = 00:09 {
filename "grub/grubx64.efi";
}
# armv7 (aka arm 32 bit)
else if option system-arch = 00:0a {
filename "grub/armv7.efi";
}
# aarch64 (aka arm 64 bit)
else if option system-arch = 00:0b {
filename "grub/grubaa64.efi";
}
# RiskV 32 bit
else if option system-arch = 00:25 {
#ToDo petitboot loader
# petitboot should support pxelinux config files
filename "unsupported";
}
#RiskV 32 bit
else if option system-arch = 00:27 {
#ToDo petitboot loader
# petitboot should support pxelinux config files
filename "unsupported";
}
else if option system-arch = 00:0e {
# FIXME add petitboot support for ppc64(le)
filename "grub/grub.ppc64le";
}
else
{
filename "grub/grub.0";
}
}
}

# Dummy subnet for the "orthos" Docker network itself (see compose.common.yaml's pinned
# "networks.orthos.ipam.config") - dhcpd refuses to listen on *any* interface unless every network
# it's actually attached to has a matching "subnet" declaration, and the "cobbler-dhcp" sidecar's
# only interface is on this bridge network, not a real "192.0.2.0/24" segment. No "range" here on
# purpose: this subnet exists only so dhcpd accepts binding to that interface at all - it hands out
# no leases and PXE clients are served by the "192.0.2.0/24" subnet above.
subnet 172.20.0.0 netmask 255.255.0.0 {
}

#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets or really any valid dhcpd.conf construct ...
## if you only use the default dhcp tag in cobbler, the group block can be deleted for a flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
#for mac in $dhcp_tags[$dhcp_tag].keys():
#set iface = $dhcp_tags[$dhcp_tag][$mac]
host $iface.name {
#if $iface.interface_type == "infiniband":
option dhcp-client-identifier = $mac;
#else
hardware ethernet $mac;
#end if
#if $iface.ipv4.address:
fixed-address $iface.ipv4.address;
#end if
#if $iface.dns.name:
option host-name "$iface.dns.name";
#else if $iface.hostname:
option host-name "$iface.hostname";
#end if
#if $iface.ipv4.netmask:
option subnet-mask $iface.ipv4.netmask;
#end if
#if $iface.if_gateway:
option routers $iface.if_gateway;
#else if $iface.gateway:
option routers $iface.gateway;
#end if
#set breed = $getVar('iface.distro.breed',None)
#if $breed == "vmware":
#if $iface.enable_ipxe:
if option system-arch = 00:07 or option system-arch = 00:09 { ## UEFI
if exists user-class and option user-class = "iPXE" {
filename = "$iface.filename_esxi";
} else {
filename = "esxi/snponly.efi";
}
} else { ## BIOS
if exists user-class and option user-class = "iPXE" {
filename = "esxi/pxelinux.0";
} else {
filename = "esxi/undionly.pxe";
}
}
#else
if option system-arch = 00:07 or option system-arch = 00:09 {
filename = "$iface.filename_esxi";
} else {
filename = "esxi/pxelinux.0";
}
#end if
#else if $iface.enable_ipxe:
if exists user-class and option user-class = "iPXE" {
filename "http://$cobbler_server/cblr/svc/op/ipxe/system/$iface.owner";
} else {
filename "undionly.pxe";
}
#end if
#if $iface.next_server_v4:
next-server $iface.next_server_v4;
#end if
#if $iface.filename:
filename "$iface.filename";
#end if
#if $iface.dns.name_servers:
#set $mynameservers = ','.join($iface.dns.name_servers)
option domain-name-servers $mynameservers;
#end if
}
#end for
}
#end for
105 changes: 105 additions & 0 deletions docker/orthos/cobbler-templates/dhcp6.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# ******************************************************************
# Cobbler managed dhcpd6.conf file
#
# generated from cobbler dhcp6.conf template ($date)
# Do NOT make changes to /etc/dhcpd6.conf. Instead, make your changes
# in this template, as /etc/dhcpd6.conf will be overwritten.
#
# Adapted from Cobbler's built-in cheetah/etc/dhcp6.template (see
# cobbler/data/templates/cheetah/etc/dhcp6.template in the Cobbler repo) - only the
# "subnet6" block below was changed, to the "2001:db8::/64" network used by the orthos2
# dev stack, registered as the active "dhcpv6" template via
# docker/orthos/setup_cobbler_dhcp_templates.py.
# ******************************************************************

log-facility local0;

default-lease-time 14400; # 4 hours
max-lease-time 172800; # 48 hours
allow leasequery;

# Server side command to enable rapid-commit (2 packet exchange)
#option dhcp6.rapid-commit;

# The delay before information-request refresh
# (minimum is 10 minutes, maximum one day, default is to not refresh)
# (set to 6 hours)
option dhcp6.info-refresh-time 21600;

# Set preference to 255 (maximum) in order to avoid waiting for
# additional servers when there is only one
option dhcp6.preference 255;

# Global definitions for name server address(es) and domain search list
#option dhcp6.name-servers fc00:501:ffff:100:200:ff:fe00:3f3e;
option dhcp6.domain-search "orthos2.test";

option dhcp6.bootfile-url code 59 = string ;

class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if substring (option vendor-class-identifier, 15, 5) = "00007" {
option dhcp6.bootfile-url "tftp://[$next_server_v6]/grub/grubx64.efi";
}
else if substring (option vendor-class-identifier, 15, 5) = "00000" {
option dhcp6.bootfile-url "tftp://[$next_server_v6]/grub/grub.0";
}
}

subnet6 2001:db8::/64 {
range6 2001:db8::100 2001:db8::1ff;
option dhcp6.name-servers 2001:db8::1;
option dhcp6.domain-search "orthos2.test";
}


#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets
## or really any valid dhcpd.conf construct ... if you only use the
## default dhcp tag in cobbler, the group block can be deleted for a
## flat configuration
## group for Cobbler DHCP tag: $dhcp_tag
group {
#for mac in $dhcp_tags[$dhcp_tag].keys():
#set iface = $dhcp_tags[$dhcp_tag][$mac]
host $iface.name {
##
## dhcp-client-identifier
#if $iface.interface_type == "infiniband":
option dhcp-client-identifier = $mac;
#else
hardware ethernet $mac;
#end if
##
## fixed-address6
## "ipv6_address" is only ever populated by isc.py's bond/bridge-slave branch
## (cobbler/modules/managers/isc.py) - every other (i.e. almost all) interfaces only carry the
## nested "ipv6"/"address" from NetworkInterface.to_dict(), same as $iface.ipv4.address on the
## IPv4 side, causing a Cheetah "cannot find 'ipv6_address'" NameMapper error for them.
fixed-address6 $iface.ipv6.address;
##
## host-name
## Note: upstream's built-in dhcp6.template (cobbler/data/templates/cheetah/etc/dhcp6.template)
## references "$iface.dns_name" here, which cobbler/modules/managers/isc.py never populates on
## the per-interface dict it passes to this template (it only sets "hostname" and nested
## "dns"/"name" - see isc.py's write_v6_config()) - that's a real templating bug upstream,
## reproduced here as "$iface.dns.name" instead, matching dhcp.template's already-working
## equivalent check.
#if $iface.hostname:
option host-name "$iface.hostname";
#else if $iface.dns.name:
option host-name "$iface.dns.name";
#end if
##
## dhcp6.bootfile-url
## Do we have a host specific next_server or filename
## In DHCPv6 that means: Do we point to a host specific boot loader
#set host_filename = $iface.get("filename", None)
#set host_next_server_v6 = $iface.get("next_server_v6", $next_server_v6)
#if $host_next_server_v6 != $next_server_v6 or $host_filename:
option dhcp6.bootfile-url "tftp://[$host_next_server_v6]/$host_filename";
#end if
}
#end for
}
#end for
43 changes: 43 additions & 0 deletions docker/orthos/cobbler-templates/named.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
options {
listen-on port 53 { 127.0.0.1; };
directory "@@bind_zonefiles@@";
dump-file "@@bind_zonefiles@@/data/cache_dump.db";
statistics-file "@@bind_zonefiles@@/data/named_stats.txt";
memstatistics-file "@@bind_zonefiles@@/data/named_mem_stats.txt";
allow-query { localhost; };
recursion yes;
};

# Adapted from Cobbler's built-in cheetah/etc/named.template (see
# cobbler/data/templates/cheetah/etc/named.template in the Cobbler repo) - the built-in "logging"
# block below writes to a *relative* path ("data/named.run", under "directory" above) whose parent
# "data/" is never created by either cobblerd or this image, so named fails at startup validating it
# ("checking logging configuration failed: file not found") before it ever gets to loading zones.
# Log to stderr instead - Docker captures it into "docker compose logs cobbler-dns" the same as
# stdout - and drop the dependency on that missing directory entirely.
logging {
channel stdout_log {
stderr;
severity dynamic;
print-time yes;
print-severity yes;
print-category yes;
};
category default { stdout_log; };
category queries { stdout_log; };
};

#for $zone in $forward_zones
zone "${zone}." {
type master;
file "$zone";
};

#end for
#for $zone, $arpa in $reverse_zones
zone "${arpa}." {
type master;
file "$zone";
};

#end for
Loading