commit f8a5a1c66d8ac7f2279d6bb740384b70a2e549f5 Author: root Date: Thu Sep 12 10:40:51 2024 +0700 Initial Commit diff --git a/.mac-lists.csv.swp b/.mac-lists.csv.swp new file mode 100644 index 0000000..7cb788f Binary files /dev/null and b/.mac-lists.csv.swp differ diff --git a/.txt b/.txt new file mode 100644 index 0000000..20a1d76 --- /dev/null +++ b/.txt @@ -0,0 +1,10 @@ + +timeout 600 +default bootstrap +prompt 0 + +label bootstrap + menu Direct BOOTSTRAP!!! + KERNEL fcos-live-kernel.x86_64 + APPEND initrd=fcos-initramfs.x86_64.img,fcos-live-rootfs.x86_64.img coreos.inst.install_dev=sda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/master.ign + diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..023508c --- /dev/null +++ b/Readme.md @@ -0,0 +1,10 @@ +## PXE + +Use `pxelinux-generator.sh` script to generate configs and populate the target path with pxe profiles according to mac-address from `mac-lists.csv` file. + + +### Dependencies + +- initramfs and kernel file (Will make the handler later) +- pxe setup +- DHCP diff --git a/csr-approve.sh b/csr-approve.sh new file mode 100755 index 0000000..124345d --- /dev/null +++ b/csr-approve.sh @@ -0,0 +1,2 @@ +#!/bin/bash +oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve diff --git a/mac-lists.csv b/mac-lists.csv new file mode 100644 index 0000000..6bf4f26 --- /dev/null +++ b/mac-lists.csv @@ -0,0 +1,10 @@ +bootstrap,52:54:00:f1:d1:63,fcos-37,vda +master,52:54:00:70:f5:db,fcos-37,vda +master,52:54:00:1b:15:29,fcos-37,vda +master,52:54:00:47:1a:1b,fcos-37,vda +worker,52:54:00:84:b1:11,fcos-37,vda +worker,52:54:00:a1:55:1a,fcos-37,vda +worker,00:50:56:bb:f8:6d,fcos-37,sda +worker,52:54:00:5e:7c:d6,fcos-37,vda +worker,ac:1f:6b:ef:83:74,fcos-37,sda +worker,52:54:00:c0:d0:de,fcos-37,vda diff --git a/pxeconfigs/01-00-50-56-bb-f8-6d b/pxeconfigs/01-00-50-56-bb-f8-6d new file mode 100644 index 0000000..379e50c --- /dev/null +++ b/pxeconfigs/01-00-50-56-bb-f8-6d @@ -0,0 +1,40 @@ +#00:50:56:bb:f8:6d + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < 00:50:56:bb:f8:6d > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/sda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-1b-15-29 b/pxeconfigs/01-52-54-00-1b-15-29 new file mode 100644 index 0000000..4d05b7c --- /dev/null +++ b/pxeconfigs/01-52-54-00-1b-15-29 @@ -0,0 +1,40 @@ +#52:54:00:1b:15:29 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default master +default localboot +prompt 0 + +label master + menu label Ignite Openshift: master < 52:54:00:1b:15:29 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/master.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-47-1a-1b b/pxeconfigs/01-52-54-00-47-1a-1b new file mode 100644 index 0000000..587474d --- /dev/null +++ b/pxeconfigs/01-52-54-00-47-1a-1b @@ -0,0 +1,40 @@ +#52:54:00:47:1a:1b + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default master +default localboot +prompt 0 + +label master + menu label Ignite Openshift: master < 52:54:00:47:1a:1b > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/master.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-5e-7c-d6 b/pxeconfigs/01-52-54-00-5e-7c-d6 new file mode 100644 index 0000000..4145c37 --- /dev/null +++ b/pxeconfigs/01-52-54-00-5e-7c-d6 @@ -0,0 +1,40 @@ +#52:54:00:5e:7c:d6 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < 52:54:00:5e:7c:d6 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-70-f5-db b/pxeconfigs/01-52-54-00-70-f5-db new file mode 100644 index 0000000..bc1923f --- /dev/null +++ b/pxeconfigs/01-52-54-00-70-f5-db @@ -0,0 +1,40 @@ +#52:54:00:70:f5:db + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default master +default localboot +prompt 0 + +label master + menu label Ignite Openshift: master < 52:54:00:70:f5:db > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/master.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-84-b1-11 b/pxeconfigs/01-52-54-00-84-b1-11 new file mode 100644 index 0000000..7b88ae8 --- /dev/null +++ b/pxeconfigs/01-52-54-00-84-b1-11 @@ -0,0 +1,40 @@ +#52:54:00:84:b1:11 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < 52:54:00:84:b1:11 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-a1-55-1a b/pxeconfigs/01-52-54-00-a1-55-1a new file mode 100644 index 0000000..141d9e0 --- /dev/null +++ b/pxeconfigs/01-52-54-00-a1-55-1a @@ -0,0 +1,40 @@ +#52:54:00:a1:55:1a + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < 52:54:00:a1:55:1a > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-c0-d0-de b/pxeconfigs/01-52-54-00-c0-d0-de new file mode 100644 index 0000000..4597820 --- /dev/null +++ b/pxeconfigs/01-52-54-00-c0-d0-de @@ -0,0 +1,40 @@ +#52:54:00:c0:d0:de + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < 52:54:00:c0:d0:de > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-52-54-00-f1-d1-63 b/pxeconfigs/01-52-54-00-f1-d1-63 new file mode 100644 index 0000000..097cccd --- /dev/null +++ b/pxeconfigs/01-52-54-00-f1-d1-63 @@ -0,0 +1,40 @@ +#52:54:00:f1:d1:63 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default bootstrap +default localboot +prompt 0 + +label bootstrap + menu label Ignite Openshift: bootstrap < 52:54:00:f1:d1:63 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/vda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/bootstrap.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxeconfigs/01-ac-1f-6b-ef-83-74 b/pxeconfigs/01-ac-1f-6b-ef-83-74 new file mode 100644 index 0000000..a91a927 --- /dev/null +++ b/pxeconfigs/01-ac-1f-6b-ef-83-74 @@ -0,0 +1,40 @@ +#ac:1f:6b:ef:83:74 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default worker +default localboot +prompt 0 + +label worker + menu label Ignite Openshift: worker < ac:1f:6b:ef:83:74 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/sda coreos.inst.image_url=http://192.168.22.1:8080/images/fcos-37 coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/worker.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + diff --git a/pxelinux-generator.sh b/pxelinux-generator.sh new file mode 100755 index 0000000..9956fc9 --- /dev/null +++ b/pxelinux-generator.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +echo "Generating pxelinux for your configs" +rm pxeconfigs/* +rm /var/lib/tftpboot/pxelinux/pxelinux.cfg/01* + +function gen_file_config { +role=$1 +mac=$(echo $2 | sed 's/\:/\-/g') +arp_type="01" +image=$3 +disk_type=$4 + +echo "#$2 + +timeout 1200 +ui vesamenu.c32 +menu title Infidel's PXE boot Manager +# Background image *must* be the same resolution as the resolution here. +MENU RESOLUTION 640 480 +MENU BACKGROUND bg.png + +# White on a black/transparent background. +MENU COLOR screen * #ffffffff #00000000 std + +# Blue borders on a black/transparent background. +# Borders have padding, so that background matters. +MENU COLOR border * #ff0000ff #00000000 std + +# Title bar is cyan on a black/transparent background. +MENU COLOR title * #ff00ffff #00000000 std + +# Selection bar is white on a magenta/opaque background. +MENU COLOR sel * #ffffffff #ffff00ff none + +# Unselected menu items are white on black/transparent. +MENU COLOR unsel * #ffffffff #00000000 std +# menu resolution 604 455 +# menu background bg.png +# default $role +default localboot +prompt 0 + +label $role + menu label Ignite Openshift: $role < $2 > + KERNEL fcos-37-pxe/fcos-live-kernel.x86_64 + APPEND initrd=fcos-37-pxe/fcos-initramfs.x86_64.img,fcos-37-pxe/fcos-live-rootfs.x86_64.img coreos.inst.install_dev=/dev/$disk_type coreos.inst.image_url=http://192.168.22.1:8080/images/$image coreos.inst.insecure=yes coreos.inst.ignition_url=http://192.168.22.1:8080/okd-inf/$role.ign ignition.firstboot ignition.platform.id=metal + +label localboot + menu label Boot from Local Drive + localboot 0 +menu end + " > pxeconfigs/$arp_type'-'$mac +} + +while IFS="," read -r role mac image disk_type +do + echo $role ' ---> ' $mac ' Finished ' + gen_file_config $role $mac $image $disk_type +done < <( cat mac-lists.csv ) + +cp -R pxeconfigs/* /var/lib/tftpboot/pxelinux/pxelinux.cfg/ + + diff --git a/update-netra-token.sh b/update-netra-token.sh new file mode 100755 index 0000000..bb4ca40 --- /dev/null +++ b/update-netra-token.sh @@ -0,0 +1,15 @@ +#!/bin/sh -x + +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/ +/bin/sh /etc/profile + +podNameDjango=`oc get pods -l app=netra-django -n operational -o name` +podNameCli=`oc get pods -l app=inf-cli -n operational -o name` + +oc exec $podNameCli -n operational -- /usr/bin/bash butterfly/run.sh +oc exec $podNameDjango -n operational -- /usr/bin/bash src/run.sh +oc exec $podName -n operational -- /usr/bin/bash -c 'echo "Auth at $(date)" >> src/auth.log' + +#oc exec $pod-name -n operational -- echo "Testing" >> hello.txt + +