added ubuntu meta and user data and fixed ocuple scripts. Added preperations for Rocky and Alma

This commit is contained in:
Eliezer Croitoru 2023-11-14 20:32:21 +00:00
parent 2705ea9243
commit 62d860fb58
6 changed files with 66 additions and 4 deletions

View File

@ -4,14 +4,36 @@ all:
rhel:
cp -fv user-data-rhel user-data
cp -fv meta-data-rhel meta-data
bash gen-hostname-and-instance-id.sh
bash ./build.sh rhel-master-init.iso
deploy-rhel:
cp -fv rhel-master-init.iso ./isos/
rocky:
cp -fv user-data-rocky user-data
cp -fv meta-data-rocky meta-data
bash gen-hostname-and-instance-id.sh
bash ./build.sh rocky-master-init.iso
deploy-rocky:
cp -fv rocky-master-init.iso ./isos/
alma:
cp -fv user-data-alma user-data
cp -fv meta-data-alma meta-data
bash gen-hostname-and-instance-id.sh
bash ./build.sh alma-master-init.iso
deploy-alma:
cp -fv alma-master-init.iso ./isos/
debian:
cp -fv user-data-debian user-data
cp -fv meta-data-debian meta-data
bash gen-hostname-and-instance-id.sh
bash ./build.sh debian-master-init.iso
deploy-debian:
@ -20,8 +42,12 @@ deploy-debian:
ubuntu:
cp -fv user-data-ubuntu user-data
cp -fv meta-data-ubuntu meta-data
bash gen-hostname-and-instance-id.sh
bash ./build.sh ubuntu-master-init.iso
deploy-ubuntu:
cp -fv ubuntu-master-init.iso ./isos/
install-depencies-ubuntu:
apt update
apt install -y ruby genisoimage cloud-init

1
gen-cloud-init/PASSWORD Normal file
View File

@ -0,0 +1 @@
veryhardpass

View File

@ -15,11 +15,13 @@ fi
SSH_KEY1=$(head -1 "SSH_KEY1")
SSH_KEY2=$(head -1 "SSH_KEY2")
SSH_KEY3=$(head -1 "SSH_KEY3")
PASSWORD=$(head -1 "PASSWORD")
cat user-data | ruby replace.rb "###SSH_KEY_1###" "${SSH_KEY1}" | ruby replace.rb "###SSH_KEY_2###" "${SSH_KEY2}" | ruby replace.rb "###SSH_KEY_3###" "${SSH_KEY3}" > user-data.in && \
cat user-data | ruby replace.rb "###PASSWORD###" "${PASSWORD}" | ruby replace.rb "###SSH_KEY_1###" "${SSH_KEY1}" | ruby replace.rb "###SSH_KEY_2###" "${SSH_KEY2}" | ruby replace.rb "###SSH_KEY_3###" "${SSH_KEY3}" > user-data.in && \
cp -vf user-data.in user-data
cloud-init devel schema --config-file user-data
#cloud-init devel schema --config-file user-data
#cloud-init query user-data
genisoimage -output ${FILENAME} -volid cidata -joliet -rock user-data meta-data

View File

@ -7,7 +7,7 @@ if [ -z "${OS_DISTRO}" ];then
fi
INSTANCE_ID="$( uuidgen |cut -d '-' -f 1 )"
HOSTNAME="$(OS_DISTRO)-${INSTANCE_ID}"
HOSTNAME="${OS_DISTRO}-${INSTANCE_ID}"
cat meta-data | ruby replace.rb "##INSTANCE_ID##" "${INSTANCE_ID}" | ruby replace.rb "##HOSTNAME##" "${HOSTNAME}" > meta-data.in && \
cp -vf meta-data.in > meta-data
cp -vf meta-data.in meta-data

View File

@ -0,0 +1,2 @@
instance-id: ##INSTANCE_ID##
local-hostname: ##HOSTNAME##

View File

@ -0,0 +1,31 @@
#cloud-config
# remove this block entirely if not using password authentication
password: ###PASSWORD###
ssh_pwauth: True
chpasswd: { expire: False }
package_upgrade: true
packages:
- git
- htop
- tmux
- wget
# replace with your own public key (e.g. ~/.ssh/id_rsa.pub)
ssh_authorized_keys:
- ###SSH_KEY_1###
- ###SSH_KEY_2###
- ###SSH_KEY_3###
users:
- default
- name: root
ssh_authorized_keys:
- ###SSH_KEY_1###
- ###SSH_KEY_2###
- ###SSH_KEY_3###
runcmd:
- [ "/usr/bin/wget" , "https://raw.githubusercontent.com/elico/ispmail-project/master/debian-bullseye-il-sources.list" , "-O" , "/etc/apt/sources.list.debian-11.in" ]
final_message: "The system is finally up, after $UPTIME seconds"