Initial Commit

This commit is contained in:
root 2024-09-12 10:40:51 +07:00
commit f8a5a1c66d
17 changed files with 511 additions and 0 deletions

BIN
.mac-lists.csv.swp Normal file

Binary file not shown.

10
.txt Normal file
View File

@ -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

10
Readme.md Normal file
View File

@ -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

2
csr-approve.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
oc get csr -ojson | jq -r '.items[] | select(.status == {} ) | .metadata.name' | xargs oc adm certificate approve

10
mac-lists.csv Normal file
View File

@ -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
1 bootstrap 52:54:00:f1:d1:63 fcos-37 vda
2 master 52:54:00:70:f5:db fcos-37 vda
3 master 52:54:00:1b:15:29 fcos-37 vda
4 master 52:54:00:47:1a:1b fcos-37 vda
5 worker 52:54:00:84:b1:11 fcos-37 vda
6 worker 52:54:00:a1:55:1a fcos-37 vda
7 worker 00:50:56:bb:f8:6d fcos-37 sda
8 worker 52:54:00:5e:7c:d6 fcos-37 vda
9 worker ac:1f:6b:ef:83:74 fcos-37 sda
10 worker 52:54:00:c0:d0:de fcos-37 vda

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

64
pxelinux-generator.sh Executable file
View File

@ -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/

15
update-netra-token.sh Executable file
View File

@ -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