From a630bfb90af6136dd629f1144858f164bd5fa5ad Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 6 Sep 2024 12:56:14 +0300 Subject: [PATCH] init --- .gitignore | 65 ++++ .global/.common/prepare-os.sh | 34 ++ .global/.common/prepare-pve.sh | 59 ++++ .global/.common/qm-clone-vm-multi.sh | 81 +++++ .global/.common/qm-clone-vm.sh | 53 +++ .global/.common/qm-create-vm-via-template.sh | 34 ++ .global/.common/qm-create-vm.sh | 66 ++++ .global/.common/qm-destroy-vm.sh | 48 +++ .global/.common/qm-run-test.sh | 19 ++ .global/.common/qm-start-test-vm.sh | 29 ++ .global/.common/qm-stop-and-destoroy.sh | 21 ++ .global/.common/qm-stop-vm.sh | 20 ++ .global/.common/test-global.sh | 14 + .global/.env.sh | 200 ++++++++++++ .global/.env_local_example.sh | 5 + .global/init.sh | 31 ++ .global/test.sh | 4 + .utils/.env-example.yml | 309 ++++++++++++++++++ .../cloud-init/cloud-init-centos.yml.jinja2 | 81 +++++ .../cloud-init/cloud-init-debian.yml.jinja2 | 92 ++++++ .../cloud-init/cloud-init-rocky.yml.jinja2 | 87 +++++ .../cloud-init/cloud-init-ubuntu.yml.jinja2 | 92 ++++++ .utils/.tpl/cloud-init/cloud-init.yml.jinja2 | 92 ++++++ .utils/.tpl/sh/env_custom.sh.jinja2 | 62 ++++ .../.tpl/sh/prepare-virt-customize.sh.jinja2 | 105 ++++++ .utils/cloud-init-default-gen.py | 45 +++ .utils/env-custom-gen.py | 29 ++ .utils/prepare-virt-customize-gen.py | 50 +++ .utils/prepare.py | 31 ++ .utils/re-build.sh | 8 + README.md | 11 + centos/.common/.images/.gitkeep | 0 centos/7/.envs/.env.sh | 1 + centos/7/.envs/.env_custom.sh | 62 ++++ centos/7/.images/.gitkeep | 0 centos/7/init.sh | 1 + centos/7/prepare-os.sh | 1 + centos/7/prepare-pve.sh | 1 + centos/7/qm-clone-vm.sh | 1 + centos/7/qm-create-vm.sh | 1 + centos/7/qm-destroy-vm.sh | 1 + centos/7/qm-stop-vm.sh | 1 + centos/8/.envs/.env.sh | 1 + centos/8/.envs/.env_custom.sh | 62 ++++ centos/8/.images/.gitkeep | 0 centos/8/init.sh | 1 + centos/8/prepare-os.sh | 1 + centos/8/prepare-pve.sh | 1 + centos/8/qm-clone-vm.sh | 1 + centos/8/qm-create-vm.sh | 1 + centos/8/qm-destroy-vm.sh | 1 + centos/8/qm-stop-vm.sh | 1 + centos/9/.envs/.env.sh | 1 + centos/9/.envs/.env_custom.sh | 62 ++++ centos/9/.images/.gitkeep | 0 centos/9/init.sh | 1 + centos/9/prepare-os.sh | 1 + centos/9/prepare-pve.sh | 1 + centos/9/qm-clone-vm.sh | 1 + centos/9/qm-create-vm.sh | 1 + centos/9/qm-destroy-vm.sh | 1 + centos/9/qm-stop-vm.sh | 1 + centos/BUG.md | 9 + debian/.common/.images/.gitkeep | 0 debian/bookworm-12/.envs/.env.sh | 1 + debian/bookworm-12/.envs/.env_custom.sh | 62 ++++ debian/bookworm-12/.images/.gitkeep | 0 debian/bookworm-12/init.sh | 1 + debian/bookworm-12/prepare-os.sh | 1 + debian/bookworm-12/prepare-pve.sh | 1 + debian/bookworm-12/qm-clone-vm.sh | 1 + debian/bookworm-12/qm-create-vm.sh | 1 + debian/bookworm-12/qm-destroy-vm.sh | 1 + debian/bookworm-12/qm-stop-vm.sh | 1 + debian/bullseye-11/.envs/.env.sh | 1 + debian/bullseye-11/.envs/.env_custom.sh | 62 ++++ debian/bullseye-11/.images/.gitkeep | 0 debian/bullseye-11/init.sh | 1 + debian/bullseye-11/prepare-os.sh | 1 + debian/bullseye-11/prepare-pve.sh | 1 + debian/bullseye-11/qm-clone-vm.sh | 1 + debian/bullseye-11/qm-create-vm.sh | 1 + debian/bullseye-11/qm-destroy-vm.sh | 1 + debian/bullseye-11/qm-stop-vm.sh | 1 + debian/buster-10/.envs/.env.sh | 1 + debian/buster-10/.envs/.env_custom.sh | 62 ++++ debian/buster-10/.images/.gitkeep | 0 .../buster-10/.templates/debian-default.yml | 56 ++++ debian/buster-10/init.sh | 1 + debian/buster-10/prepare-os.sh | 1 + debian/buster-10/prepare-pve.sh | 1 + debian/buster-10/qm-clone-vm.sh | 1 + debian/buster-10/qm-create-vm.sh | 1 + debian/buster-10/qm-destroy-vm.sh | 1 + debian/buster-10/qm-stop-vm.sh | 1 + debian/stretch-9/.envs/.env.sh | 1 + debian/stretch-9/.envs/.env_custom.sh | 62 ++++ debian/stretch-9/.images/.gitkeep | 0 debian/stretch-9/init.sh | 1 + debian/stretch-9/prepare-os.sh | 1 + debian/stretch-9/prepare-pve.sh | 1 + debian/stretch-9/qm-clone-vm.sh | 1 + debian/stretch-9/qm-create-vm.sh | 1 + debian/stretch-9/qm-destroy-vm.sh | 1 + debian/stretch-9/qm-stop-vm.sh | 1 + debian/trixie-13/.envs/.env.sh | 1 + debian/trixie-13/.envs/.env_custom.sh | 62 ++++ debian/trixie-13/.images/.gitkeep | 0 debian/trixie-13/init.sh | 1 + debian/trixie-13/prepare-os.sh | 1 + debian/trixie-13/prepare-pve.sh | 1 + debian/trixie-13/qm-clone-vm.sh | 1 + debian/trixie-13/qm-create-vm.sh | 1 + debian/trixie-13/qm-destroy-vm.sh | 1 + debian/trixie-13/qm-stop-vm.sh | 1 + rocky/.common/.images/.gitkeep | 0 rocky/.common/README.md | 1 + rocky/rocky-8/.envs/.env.sh | 1 + rocky/rocky-8/.envs/.env_custom.sh | 62 ++++ rocky/rocky-8/.images/.gitkeep | 0 rocky/rocky-8/init.sh | 1 + rocky/rocky-8/prepare-os.sh | 1 + rocky/rocky-8/prepare-pve.sh | 1 + rocky/rocky-8/qm-clone-vm.sh | 1 + rocky/rocky-8/qm-create-vm.sh | 1 + rocky/rocky-8/qm-destroy-vm.sh | 1 + rocky/rocky-8/qm-stop-vm.sh | 1 + rocky/rocky-9/.envs/.env.sh | 1 + rocky/rocky-9/.envs/.env_custom.sh | 62 ++++ rocky/rocky-9/.images/.gitkeep | 0 rocky/rocky-9/init.sh | 1 + rocky/rocky-9/prepare-os.sh | 1 + rocky/rocky-9/prepare-pve.sh | 1 + rocky/rocky-9/qm-clone-vm.sh | 1 + rocky/rocky-9/qm-create-vm.sh | 1 + rocky/rocky-9/qm-destroy-vm.sh | 1 + rocky/rocky-9/qm-stop-vm.sh | 1 + ubuntu/.common/.images/.gitkeep | 0 ubuntu/UBUNTU.md | 23 ++ ubuntu/focal-20.04/.envs/.env.sh | 1 + ubuntu/focal-20.04/.envs/.env_custom.sh | 62 ++++ ubuntu/focal-20.04/.images/.gitkeep | 0 ubuntu/focal-20.04/init.sh | 1 + ubuntu/focal-20.04/prepare-os.sh | 1 + ubuntu/focal-20.04/prepare-pve.sh | 1 + ubuntu/focal-20.04/qm-clone-vm.sh | 1 + ubuntu/focal-20.04/qm-create-vm.sh | 1 + ubuntu/focal-20.04/qm-destroy-vm.sh | 1 + ubuntu/focal-20.04/qm-stop-vm.sh | 1 + ubuntu/jammy-22.04/.envs/.env.sh | 1 + ubuntu/jammy-22.04/.envs/.env_custom.sh | 62 ++++ ubuntu/jammy-22.04/.images/.gitkeep | 0 ubuntu/jammy-22.04/init.sh | 1 + ubuntu/jammy-22.04/prepare-os.sh | 1 + ubuntu/jammy-22.04/prepare-pve.sh | 1 + ubuntu/jammy-22.04/qm-clone-vm.sh | 1 + ubuntu/jammy-22.04/qm-create-vm.sh | 1 + ubuntu/jammy-22.04/qm-destroy-vm.sh | 1 + ubuntu/jammy-22.04/qm-stop-vm.sh | 1 + ubuntu/noble-24.04/.envs/.env.sh | 1 + ubuntu/noble-24.04/.envs/.env_custom.sh | 62 ++++ ubuntu/noble-24.04/.images/.gitkeep | 0 ubuntu/noble-24.04/init.sh | 1 + ubuntu/noble-24.04/prepare-os.sh | 1 + ubuntu/noble-24.04/prepare-pve.sh | 1 + ubuntu/noble-24.04/qm-clone-vm.sh | 1 + ubuntu/noble-24.04/qm-create-vm.sh | 1 + ubuntu/noble-24.04/qm-destroy-vm.sh | 1 + ubuntu/noble-24.04/qm-stop-vm.sh | 1 + 169 files changed, 2876 insertions(+) create mode 100644 .gitignore create mode 100755 .global/.common/prepare-os.sh create mode 100755 .global/.common/prepare-pve.sh create mode 100755 .global/.common/qm-clone-vm-multi.sh create mode 100755 .global/.common/qm-clone-vm.sh create mode 100755 .global/.common/qm-create-vm-via-template.sh create mode 100755 .global/.common/qm-create-vm.sh create mode 100755 .global/.common/qm-destroy-vm.sh create mode 100755 .global/.common/qm-run-test.sh create mode 100755 .global/.common/qm-start-test-vm.sh create mode 100755 .global/.common/qm-stop-and-destoroy.sh create mode 100755 .global/.common/qm-stop-vm.sh create mode 100755 .global/.common/test-global.sh create mode 100644 .global/.env.sh create mode 100644 .global/.env_local_example.sh create mode 100755 .global/init.sh create mode 100755 .global/test.sh create mode 100644 .utils/.env-example.yml create mode 100644 .utils/.tpl/cloud-init/cloud-init-centos.yml.jinja2 create mode 100644 .utils/.tpl/cloud-init/cloud-init-debian.yml.jinja2 create mode 100644 .utils/.tpl/cloud-init/cloud-init-rocky.yml.jinja2 create mode 100644 .utils/.tpl/cloud-init/cloud-init-ubuntu.yml.jinja2 create mode 100644 .utils/.tpl/cloud-init/cloud-init.yml.jinja2 create mode 100644 .utils/.tpl/sh/env_custom.sh.jinja2 create mode 100755 .utils/.tpl/sh/prepare-virt-customize.sh.jinja2 create mode 100644 .utils/cloud-init-default-gen.py create mode 100644 .utils/env-custom-gen.py create mode 100644 .utils/prepare-virt-customize-gen.py create mode 100644 .utils/prepare.py create mode 100755 .utils/re-build.sh create mode 100644 README.md create mode 100644 centos/.common/.images/.gitkeep create mode 120000 centos/7/.envs/.env.sh create mode 100644 centos/7/.envs/.env_custom.sh create mode 100644 centos/7/.images/.gitkeep create mode 120000 centos/7/init.sh create mode 120000 centos/7/prepare-os.sh create mode 120000 centos/7/prepare-pve.sh create mode 120000 centos/7/qm-clone-vm.sh create mode 120000 centos/7/qm-create-vm.sh create mode 120000 centos/7/qm-destroy-vm.sh create mode 120000 centos/7/qm-stop-vm.sh create mode 120000 centos/8/.envs/.env.sh create mode 100644 centos/8/.envs/.env_custom.sh create mode 100644 centos/8/.images/.gitkeep create mode 120000 centos/8/init.sh create mode 120000 centos/8/prepare-os.sh create mode 120000 centos/8/prepare-pve.sh create mode 120000 centos/8/qm-clone-vm.sh create mode 120000 centos/8/qm-create-vm.sh create mode 120000 centos/8/qm-destroy-vm.sh create mode 120000 centos/8/qm-stop-vm.sh create mode 120000 centos/9/.envs/.env.sh create mode 100644 centos/9/.envs/.env_custom.sh create mode 100644 centos/9/.images/.gitkeep create mode 120000 centos/9/init.sh create mode 120000 centos/9/prepare-os.sh create mode 120000 centos/9/prepare-pve.sh create mode 120000 centos/9/qm-clone-vm.sh create mode 120000 centos/9/qm-create-vm.sh create mode 120000 centos/9/qm-destroy-vm.sh create mode 120000 centos/9/qm-stop-vm.sh create mode 100644 centos/BUG.md create mode 100644 debian/.common/.images/.gitkeep create mode 120000 debian/bookworm-12/.envs/.env.sh create mode 100644 debian/bookworm-12/.envs/.env_custom.sh create mode 100644 debian/bookworm-12/.images/.gitkeep create mode 120000 debian/bookworm-12/init.sh create mode 120000 debian/bookworm-12/prepare-os.sh create mode 120000 debian/bookworm-12/prepare-pve.sh create mode 120000 debian/bookworm-12/qm-clone-vm.sh create mode 120000 debian/bookworm-12/qm-create-vm.sh create mode 120000 debian/bookworm-12/qm-destroy-vm.sh create mode 120000 debian/bookworm-12/qm-stop-vm.sh create mode 120000 debian/bullseye-11/.envs/.env.sh create mode 100644 debian/bullseye-11/.envs/.env_custom.sh create mode 100644 debian/bullseye-11/.images/.gitkeep create mode 120000 debian/bullseye-11/init.sh create mode 120000 debian/bullseye-11/prepare-os.sh create mode 120000 debian/bullseye-11/prepare-pve.sh create mode 120000 debian/bullseye-11/qm-clone-vm.sh create mode 120000 debian/bullseye-11/qm-create-vm.sh create mode 120000 debian/bullseye-11/qm-destroy-vm.sh create mode 120000 debian/bullseye-11/qm-stop-vm.sh create mode 120000 debian/buster-10/.envs/.env.sh create mode 100644 debian/buster-10/.envs/.env_custom.sh create mode 100644 debian/buster-10/.images/.gitkeep create mode 100644 debian/buster-10/.templates/debian-default.yml create mode 120000 debian/buster-10/init.sh create mode 120000 debian/buster-10/prepare-os.sh create mode 120000 debian/buster-10/prepare-pve.sh create mode 120000 debian/buster-10/qm-clone-vm.sh create mode 120000 debian/buster-10/qm-create-vm.sh create mode 120000 debian/buster-10/qm-destroy-vm.sh create mode 120000 debian/buster-10/qm-stop-vm.sh create mode 120000 debian/stretch-9/.envs/.env.sh create mode 100644 debian/stretch-9/.envs/.env_custom.sh create mode 100644 debian/stretch-9/.images/.gitkeep create mode 120000 debian/stretch-9/init.sh create mode 120000 debian/stretch-9/prepare-os.sh create mode 120000 debian/stretch-9/prepare-pve.sh create mode 120000 debian/stretch-9/qm-clone-vm.sh create mode 120000 debian/stretch-9/qm-create-vm.sh create mode 120000 debian/stretch-9/qm-destroy-vm.sh create mode 120000 debian/stretch-9/qm-stop-vm.sh create mode 120000 debian/trixie-13/.envs/.env.sh create mode 100644 debian/trixie-13/.envs/.env_custom.sh create mode 100644 debian/trixie-13/.images/.gitkeep create mode 120000 debian/trixie-13/init.sh create mode 120000 debian/trixie-13/prepare-os.sh create mode 120000 debian/trixie-13/prepare-pve.sh create mode 120000 debian/trixie-13/qm-clone-vm.sh create mode 120000 debian/trixie-13/qm-create-vm.sh create mode 120000 debian/trixie-13/qm-destroy-vm.sh create mode 120000 debian/trixie-13/qm-stop-vm.sh create mode 100644 rocky/.common/.images/.gitkeep create mode 100644 rocky/.common/README.md create mode 120000 rocky/rocky-8/.envs/.env.sh create mode 100644 rocky/rocky-8/.envs/.env_custom.sh create mode 100644 rocky/rocky-8/.images/.gitkeep create mode 120000 rocky/rocky-8/init.sh create mode 120000 rocky/rocky-8/prepare-os.sh create mode 120000 rocky/rocky-8/prepare-pve.sh create mode 120000 rocky/rocky-8/qm-clone-vm.sh create mode 120000 rocky/rocky-8/qm-create-vm.sh create mode 120000 rocky/rocky-8/qm-destroy-vm.sh create mode 120000 rocky/rocky-8/qm-stop-vm.sh create mode 120000 rocky/rocky-9/.envs/.env.sh create mode 100644 rocky/rocky-9/.envs/.env_custom.sh create mode 100644 rocky/rocky-9/.images/.gitkeep create mode 120000 rocky/rocky-9/init.sh create mode 120000 rocky/rocky-9/prepare-os.sh create mode 120000 rocky/rocky-9/prepare-pve.sh create mode 120000 rocky/rocky-9/qm-clone-vm.sh create mode 120000 rocky/rocky-9/qm-create-vm.sh create mode 120000 rocky/rocky-9/qm-destroy-vm.sh create mode 120000 rocky/rocky-9/qm-stop-vm.sh create mode 100644 ubuntu/.common/.images/.gitkeep create mode 100644 ubuntu/UBUNTU.md create mode 120000 ubuntu/focal-20.04/.envs/.env.sh create mode 100644 ubuntu/focal-20.04/.envs/.env_custom.sh create mode 100644 ubuntu/focal-20.04/.images/.gitkeep create mode 120000 ubuntu/focal-20.04/init.sh create mode 120000 ubuntu/focal-20.04/prepare-os.sh create mode 120000 ubuntu/focal-20.04/prepare-pve.sh create mode 120000 ubuntu/focal-20.04/qm-clone-vm.sh create mode 120000 ubuntu/focal-20.04/qm-create-vm.sh create mode 120000 ubuntu/focal-20.04/qm-destroy-vm.sh create mode 120000 ubuntu/focal-20.04/qm-stop-vm.sh create mode 120000 ubuntu/jammy-22.04/.envs/.env.sh create mode 100644 ubuntu/jammy-22.04/.envs/.env_custom.sh create mode 100644 ubuntu/jammy-22.04/.images/.gitkeep create mode 120000 ubuntu/jammy-22.04/init.sh create mode 120000 ubuntu/jammy-22.04/prepare-os.sh create mode 120000 ubuntu/jammy-22.04/prepare-pve.sh create mode 120000 ubuntu/jammy-22.04/qm-clone-vm.sh create mode 120000 ubuntu/jammy-22.04/qm-create-vm.sh create mode 120000 ubuntu/jammy-22.04/qm-destroy-vm.sh create mode 120000 ubuntu/jammy-22.04/qm-stop-vm.sh create mode 120000 ubuntu/noble-24.04/.envs/.env.sh create mode 100644 ubuntu/noble-24.04/.envs/.env_custom.sh create mode 100644 ubuntu/noble-24.04/.images/.gitkeep create mode 120000 ubuntu/noble-24.04/init.sh create mode 120000 ubuntu/noble-24.04/prepare-os.sh create mode 120000 ubuntu/noble-24.04/prepare-pve.sh create mode 120000 ubuntu/noble-24.04/qm-clone-vm.sh create mode 120000 ubuntu/noble-24.04/qm-create-vm.sh create mode 120000 ubuntu/noble-24.04/qm-destroy-vm.sh create mode 120000 ubuntu/noble-24.04/qm-stop-vm.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..755f7d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +**/*.img +**/*.qcow2 +**/.env_local.sh +**/.env.yml + +# Created by .ignore support plugin (hsz.mobi) +.idea +.project +.settings +**/.DS_Store +**/venv +# +**/*.retry +**/json2hcl + +# +**/tmp +**/.tmp +**/*.tar.gz + +# +roles/utils/files/markdown/md-to-toc/build +roles/utils/files/markdown/md-to-toc/dist + +# keys +#**/keys +#**/keys/* +!roles/_local/access/templates/keys +!roles/_local/access/files/keys +!roles/_local/utils/tasks/files/keys + +#roles/utils/files/docker/ + +# py +/roles/utils/files/markdown/md_toc/md_toc.egg-info/ +/roles/utils/files/markdown/md-to-toc/md_to_toc.egg-info + +*.pyc + + +# +**/.kitchen +**/terraform.tfstate.d + +## terrform ignore + +**/.terraform +**/planfile.bin +**/*.tf.swp +**/terraform.tfvars +**/terraform.tfstate +**/terraform.tfstate.backup + +# +roles/jenkins-agent/molecule/roles/* +!roles/jenkins-agent/molecule/roles/.gitkeep + +**/.virtualenv + +/Postgress/postgresDBSamples/ +/k8s/asus2680v3/ssl-helm/files/ + +# +**/cloud-init-*-default.yml +**/prepare-virt-customize.sh diff --git a/.global/.common/prepare-os.sh b/.global/.common/prepare-os.sh new file mode 100755 index 0000000..0e746b3 --- /dev/null +++ b/.global/.common/prepare-os.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then +cat << EOF +Prepare os +- install dependens +EOF +fi + +echo "prepare-pve:" +echo " CLOUD_INIT_TEMPLATE_NAME = ${CLOUD_INIT_TEMPLATE_NAME}" +echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + +# prepare, install libguestfs-tools +if dpkg -l | grep libguestfs-tools; then + echo "libguestfs-tools exists..." +else + echo not found + # All commands will be executed on a Proxmox host !!! + sudo apt update -y && sudo apt install libguestfs-tools -y +fi +if dpkg -l | grep wget; then + echo "wget exists..." +else + echo "not found" + # All commands will be executed on a Proxmox host !!! + sudo apt update -y && sudo apt install wget -y +fi diff --git a/.global/.common/prepare-pve.sh b/.global/.common/prepare-pve.sh new file mode 100755 index 0000000..b0dfbe2 --- /dev/null +++ b/.global/.common/prepare-pve.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -e # exit on first error +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then +cat << EOF +Prepare pve +- check vm +- check templates + + -ca|--copy-all) + PV_TEMPLATES_COPY_ALL="all" + + -cf-name|--cloud-init-template-name : set env CLOUD_INIT_TEMPLATE_NAME + -img-base|--image-virt-base-name : set env IMAGE_NAME + -img-custom|--image-virt-customize-name : set env IMAGE_VIRT_CUSTOMIZE_NAME + +EOF +exit 1 +fi + +if [[ -z ${PV_TEMPLATES_COPY_ALL} ]]; then + export PV_TEMPLATES_COPY_ALL="" +fi + +echo "Prepare pve:" +echo " CLOUD_INIT_TEMPLATE_NAME = ${CLOUD_INIT_TEMPLATE_NAME}" +echo " PV_TEMPLATES_COPY_ALL = ${PV_TEMPLATES_COPY_ALL}" +echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + +if [[ ${PV_TEMPLATES_COPY_ALL} == "all" ]]; then + echo -e "\nCopy all templates from folder" + cp -f ./.templates/*.yml "${PV_STORAGE_SNIPPETS_PATH}" + exit 0 +fi + +echo -e "\nCopy templates to local ${PV_STORAGE_SNIPPETS_PATH} ..." + +# check +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + echo -e "\nPlease set CLOUD_INIT_TEMPLATE_NAME via -cf-name|--cloud-init-template-name options\n\n" + exit 1 +fi + +if [[ ! -f ./.templates/${CLOUD_INIT_TEMPLATE_NAME} ]]; then + echo -e "\nTemplates ./.templates/${CLOUD_INIT_TEMPLATE_NAME} not exists" + exit 1 +fi + +if [[ ! -f ${PV_STORAGE_SNIPPETS_PATH}${CLOUD_INIT_TEMPLATE_NAME} ]]; then + cp ./.templates/${CLOUD_INIT_TEMPLATE_NAME} /var/lib/vz/snippets/ +else + echo -e "\nCLOUD_INIT_TEMPLATE_NAME is: [${CLOUD_INIT_TEMPLATE_NAME}], ${PV_STORAGE_SNIPPETS_PATH}${CLOUD_INIT_TEMPLATE_NAME} - exit ..." + exit 0 +fi diff --git a/.global/.common/qm-clone-vm-multi.sh b/.global/.common/qm-clone-vm-multi.sh new file mode 100755 index 0000000..9346dc6 --- /dev/null +++ b/.global/.common/qm-clone-vm-multi.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +#----- celan -------- +echo -e "... Info ..." +echo -e "VM_ID $VM_ID" + +echo -e "... Create ..." +# ./qm-clone-vm-multi.sh --size 15 --net 1 --start 1 --vm 1 2 3 4 + +usage(){ echo 'usage: ...'; exit 2; } +while [ "$#" -gt 1 ]; do + case $1 in + --size) VM_SIZE=$2; shift 2;; + --net) VM_SET_DEFAULT_NET=$2; shift 2;; + --start) VM_START=$2; shift 2;; + --vm) + shift + while [ "$#" -gt 0 ]; do + case $1 in + --vm*) break;; + *) vm+=("$1"); shift;; + esac + done + ;; + *) usage ;; + esac +done +[ "$#" -gt 0 ] && usage + +echo "... will increace disk size to +${VM_SIZE}Gb" + +for p in "${vm[@]}"; do + echo "... will create next vm -- ${VM_CLONE_ID}$p" +done +echo "... will vm set default net: ${VM_SET_DEFAULT_NET}" +echo "... will vm start 0/1: ${VM_START}" + +# +for VM_CLONE_ID_INC in "${vm[@]}"; do + + echo "${VM_CLONE_ID}${VM_CLONE_ID_INC}" + qm clone ${VM_ID} "${VM_CLONE_ID}${VM_CLONE_ID_INC}" --full --name ${VM_CLONE_NAME} > /dev/null + + echo -e "... Setup, copy cloud-init template to local folder /var/lib/vz/snippets/ ..." + echo -e "... qm set ${VM_CLONE_ID}${VM_CLONE_ID_INC} --cicustom user=local:snippets/${VM_ID}-${OS_DISTR_NAME}${CLOUD_INIT_EXTRA:--}cloud-init.yml" + qm set ${VM_CLONE_ID}${VM_CLONE_ID_INC} --cicustom "user=local:snippets/${VM_ID}-${OS_DISTR_NAME}${CLOUD_INIT_EXTRA:--}cloud-init.yml" + qm set ${VM_CLONE_ID}${VM_CLONE_ID_INC} --ipconfig0 "${VM_IPCONFIG0}" + + # run first time, no image provide + if [ -z "$VM_SIZE" ]; then + echo -e "... skip resize..." + else + echo -e "... resize vm to ${1}GB..." + echo -e "... qm resize ${VM_CLONE_ID}${VM_CLONE_ID_INC} scsi0 \"+${VM_SIZE}G\"..." + sleep 5 + qm resize "${VM_CLONE_ID}${VM_CLONE_ID_INC}" scsi0 "+${VM_SIZE}G" + fi + + #echo -e "... qm set "${VM_CLONE_ID}${VM_CLONE_ID_INC}" --ipconfig0 \"ip=192.168.0.16${VM_CLONE_ID_INC}/24,gw=192.168.0.189\"" + echo -e "... qm set "${VM_CLONE_ID}${VM_CLONE_ID_INC}" --ipconfig0 ${VM_IPCONFIG0}" + if [ -z "$VM_SET_DEFAULT_NET" ]; then + echo -e "... skip net default net..." + else + #qm set "${VM_CLONE_ID}${VM_CLONE_ID_INC}" --ipconfig0 "ip=192.168.0.16${VM_CLONE_ID_INC}/24,gw=192.168.0.189" + qm set "${VM_CLONE_ID}${VM_CLONE_ID_INC}" --ipconfig0 "${VM_IPCONFIG0}" + fi + + echo -e "... qm start "${VM_CLONE_ID}${VM_CLONE_ID_INC}"" + if [ -z "$VM_START" ]; then + echo -e "...skip start..." + else + qm start "${VM_CLONE_ID}${VM_CLONE_ID_INC}" + fi + +done diff --git a/.global/.common/qm-clone-vm.sh b/.global/.common/qm-clone-vm.sh new file mode 100755 index 0000000..60f5b30 --- /dev/null +++ b/.global/.common/qm-clone-vm.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -e # exit on first error +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then +cat << EOF +usage: ...\n ./qm-clone-vm.sh --size 15 --net 1 --start 1'; +EOF +exit 1 +fi + +echo -e "... Check, that cloud-init template in local folder, like /var/lib/vz/snippets/ and exist of the file" +./prepare-pve.sh $@ + +echo -e "... clone VM ${VM_ID} to VM_CLONE_ID ${VM_CLONE_ID}" +if [ ! -z "${DISPLAY_DEBUG}" ]; then + echo -e "... qm clone ${VM_ID} ${VM_CLONE_ID} --full --name ${VM_CLONE_NAME}" + qm clone "${VM_ID}" "${VM_CLONE_ID}" --full --name ${VM_CLONE_NAME} +else + echo -e "... qm clone ${VM_ID} ${VM_CLONE_ID} --full --name ${VM_CLONE_NAME} > /dev/null" + qm clone "${VM_ID}" "${VM_CLONE_ID}" --full --name ${VM_CLONE_NAME} > /dev/null +fi + +echo -e "... qm set ${VM_ID} --cicustom user=local:snippets/${CLOUD_INIT_TEMPLATE_NAME}" +qm set ${VM_ID} --cicustom "user=local:snippets/${CLOUD_INIT_TEMPLATE_NAME}" +qm set ${VM_ID} --ipconfig0 "${VM_IPCONFIG0}" + +if [ -z "$VM_DISK_PLUS" ]; then + echo -e "... skip resize..." +else + echo -e "... resize vm to ${VM_DISK_PLUS}GB..." + echo -e "... qm resize ${VM_ID} scsi0 \"+${VM_DISK_PLUS}G\"..." + sleep 5 + qm resize ${VM_ID} scsi0 "+${VM_DISK_PLUS}G" +fi + +if [ -z "$VM_KEEP_DEFAULT_NET" ]; then + qm set "${VM_CLONE_ID}" --ipconfig0 "${VM_IPCONFIG0}" +else + echo -e "... skip set default net" +fi + +echo -e "... qm start ${VM_CLONE_ID} (VM_START is $VM_START)" + +if [ -z $VM_START ]; then + echo -e "...skip start..." +else + qm start "${VM_CLONE_ID}" +fi diff --git a/.global/.common/qm-create-vm-via-template.sh b/.global/.common/qm-create-vm-via-template.sh new file mode 100755 index 0000000..e6de8d7 --- /dev/null +++ b/.global/.common/qm-create-vm-via-template.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +echo -e "... Info ..." +echo -e "VM_ID $VM_ID" +echo -e "VM_CLONE_ID $VM_CLONE_ID" + +echo -e "... Create ..." +qm clone ${VM_ID} ${VM_CLONE_ID} --full --name ${VM_CLONE_NAME} > /dev/null + +echo -e "... Setup, copy cloud-init template to local folder /var/lib/vz/snippets/ ..." +echo -e "... qm set ${VM_CLONE_ID} --cicustom user=local:snippets/${VM_ID}-${OS_DISTR_NAME}${CLOUD_INIT_EXTRA:--}cloud-init.yml" +qm set ${VM_CLONE_ID} --cicustom "user=local:snippets/${VM_ID}-${OS_DISTR_NAME}${CLOUD_INIT_EXTRA:--}cloud-init.yml" +qm set ${VM_CLONE_ID} --ipconfig0 "${VM_IPCONFIG0}" + +# run first time, no image provide +if [ -z "$1" ]; then + echo -e "... skip resize..." +else + echo -e "... resize vm to ${1}GB..." + echo -e "... qm resize ${VM_CLONE_ID} scsi0 \"+${1}G\"..." + sleep 5 + qm resize ${VM_CLONE_ID} scsi0 "+${1}G" +fi + +echo -e "Example:" +echo -e "... qm set ${VM_CLONE_ID} --ipconfig0 \"ip=192.168.0.161/24,gw=192.168.0.189\"" +#qm start ${VM_CLONE_ID} +echo -e "... qm start ${VM_CLONE_ID}" diff --git a/.global/.common/qm-create-vm.sh b/.global/.common/qm-create-vm.sh new file mode 100755 index 0000000..b38c51c --- /dev/null +++ b/.global/.common/qm-create-vm.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e # exit on first error +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then +cat << EOF +Clone VM based on cloud image + -vm-start|--vm-start + -vm-disk|--vm-disk-plus + -img-custom|--image-virt-customize-name IMAGE_VIRT_CUSTOMIZE_NAME +EOF +exit 1 +fi + +echo -e "... Check, that cloud-init template in local folder /var/lib/vz/snippets/ ..." +./prepare-pve.sh $@ +# ... + +echo -e "... Create ..." +# Create RAW VM templates, without disk +echo " qm create ${VM_ID} --name ${VM_NAME} --memory ${VM_MEM} ${VM_SETTINGS}" +qm create ${VM_ID} --name ${VM_NAME} --memory ${VM_MEM} ${VM_SETTINGS} + +echo -e "\nqm importdisk disk ..." +echo -e "\nqm importdisk ${VM_ID} ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} ${PV_STORAGE_ID}" +qm importdisk ${VM_ID} ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} ${PV_STORAGE_ID} > /dev/null + +# Attache on exist VM, old syntax is buggy +# unused0:local-lvm:vm-9031-disk-0 +if [ "$PV_STORAGE_TYPE" == "lvm" ]; then + echo "import LVM disk" + qm set ${VM_ID} --scsihw virtio-scsi-pci --scsi0 ${PV_STORAGE_ID}:vm-${VM_ID}-disk-0 # no RAW in LVM +else + echo "import RAW disk" + qm set ${VM_ID} --scsihw virtio-scsi-pci --scsi0 ${PV_STORAGE_ID}:${VM_ID}/vm-${VM_ID}-disk-0.raw # no RAW in LVM +fi + +# Connect Cloud-init disk +qm set ${VM_ID} --ide2 ${PV_STORAGE_ID}:cloudinit +# Make boot from scsi0 +qm set ${VM_ID} --boot c --bootdisk scsi0 +# Set VGA to std +qm set ${VM_ID} --serial0 socket --vga std + +# +echo -e "... qm set ${VM_ID} --cicustom user=local:snippets/${CLOUD_INIT_TEMPLATE_NAME}" +qm set ${VM_ID} --cicustom "user=local:snippets/${CLOUD_INIT_TEMPLATE_NAME}" +qm set ${VM_ID} --ipconfig0 "${VM_IPCONFIG0}" + +# run first time, no image provide +if [ -z "$VM_DISK_PLUS" ]; then + echo -e "... skip resize..." +else + echo -e "... resize vm to ${VM_DISK_PLUS}GB..." + echo -e "... qm resize ${VM_ID} scsi0 \"+${VM_DISK_PLUS}G\"..." + sleep 5 + qm resize ${VM_ID} scsi0 "+${VM_DISK_PLUS}G" +fi + +echo -e "Example:" +echo -e "... qm set ${VM_ID} --ipconfig0 \"ip=192.168.0.161/24,gw=192.168.0.189\"" +echo -e "... qm start ${VM_ID}" diff --git a/.global/.common/qm-destroy-vm.sh b/.global/.common/qm-destroy-vm.sh new file mode 100755 index 0000000..88c5732 --- /dev/null +++ b/.global/.common/qm-destroy-vm.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then +cat << EOF +Destroy test VM +qm-destroy-vm.sh + -clean-type|--destroy-type [full|clone-only|vm] +EOF +exit 1 +fi + +echo -e "VM_ID=$VM_ID, VM_CLONE_ID=$VM_CLONE_ID, VM_DESTROY=${VM_DESTROY}, VM_DESTROY_TYPE=${VM_DESTROY_TYPE} " + +# full , clone-only, vm +if [ "${VM_DESTROY_TYPE}" == "vm" ]; then + echo -e "... qm stop $VM_ID " + qm stop $VM_ID || true + echo "clean up vm" + qm destroy $VM_ID --destroy-unreferenced-disks 1 --purge 1 +fi + +if [ "${VM_DESTROY_TYPE}" == "clone-only" ]; then + echo -e "... qm stop $VM_CLONE_ID" + qm stop $VM_CLONE_ID || true + echo "clean up clone" + echo "... qm destroy $VM_CLONE_ID --destroy-unreferenced-disks 1 --purge 1" + qm destroy $VM_CLONE_ID --destroy-unreferenced-disks 1 --purge 1 +fi + +if [ "${VM_DESTROY_TYPE}" == "full" ]; then + echo -e "... qm stop $VM_ID " + qm stop $VM_ID || true + echo -e "... qm stop $VM_CLONE_ID" + qm stop $VM_CLONE_ID || true + + echo "Full clean up" + echo "... qm destroy $VM_CLONE_ID --destroy-unreferenced-disks 1 --purge 1" + qm destroy $VM_CLONE_ID --destroy-unreferenced-disks 1 --purge 1 + + echo "... qm destroy $VM_ID --destroy-unreferenced-disks 1 --purge 1" + qm destroy $VM_ID --destroy-unreferenced-disks 1 --purge 1 +fi diff --git a/.global/.common/qm-run-test.sh b/.global/.common/qm-run-test.sh new file mode 100755 index 0000000..2cfc7ec --- /dev/null +++ b/.global/.common/qm-run-test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +cat <&2; exit 1 ;; + esac +} + +debug_cf(){ + if [[ -z ${DEBUG_CF_DISPLAYED} ]]; then + echo "envs" + echo " VM_ID = ${VM_ID}" + echo " OS_DISTR_NAME = ${OS_DISTR_NAME}" + + echo " Images:" + echo " IMAGE_NAME = ${IMAGE_NAME}" + echo " IMAGE_URL = ${IMAGE_URL}" + echo " IMAGE_VIRT_CUSTOMIZE_NAME = ${IMAGE_VIRT_CUSTOMIZE_NAME}" + echo " IMAGE_VIRT_CUSTOMIZE_PATH = ${IMAGE_VIRT_CUSTOMIZE_PATH}" + + echo " PV local" + echo " PV_STORAGE_SNIPPETS_PATH = ${PV_STORAGE_SNIPPETS_PATH}" + echo " PV_STORAGE_ID = ${PV_STORAGE_ID}" + echo " PV_STORAGE_TYPE = ${PV_STORAGE_TYPE}" + + echo " VM params:" + echo " VM_NAME = ${VM_NAME}" + echo " VM_CLONE_NAME = ${VM_CLONE_NAME}" + echo " VM_ID = ${VM_ID}" + echo " VM_CLONE_ID = ${VM_CLONE_ID}" + echo " VM_MEM = ${VM_MEM}" + echo " VM_DISK_PLUS = ${VM_DISK_PLUS}" + echo " VM_SETTINGS = ${VM_SETTINGS}" + echo " VM_DNS = ${VM_DNS}" + echo " VM_KEEP_DEFAULT_NET = ${VM_KEEP_DEFAULT_NET}" + echo " VM_IPCONFIG0 = ${VM_IPCONFIG0}" + echo " CLOUD_INIT_TEMPLATE_NAME = ${CLOUD_INIT_TEMPLATE_NAME}" + echo " VM_START = ${VM_START}" + + echo " Cloud init extra:" + echo " CLOUD_INIT_EXTRA = ${CLOUD_INIT_EXTRA}" + echo " SERT_FOLDER_PATH = ${SERT_FOLDER_PATH}" + + echo " Prepare:" + echo " PV_TEMPLATES_COPY_ALL = ${PV_TEMPLATES_COPY_ALL}" + + # rename base image + export DEBUG_CF_DISPLAYED="true" + fi + + echo "___________________________________________________________________________________________________" +} + + +POSITIONAL_ARGS=() +while [[ $# -gt 0 ]]; do + case $1 in + -d|--debug) + DISPLAY_DEBUG="true" + shift # past argument + # shift # past value + ;; + -ca|--copy-all) + PV_TEMPLATES_COPY_ALL="all" + shift # past argument + ;; + # + -vm|--vm-name) + VM_NAME="$2" + shift # past argument + shift # past value + ;; + -vm-id|--vm-id) + VM_ID="$2" + shift # past argument + shift # past value + ;; + -vm|--vm-clone-name) + VM_CLONE_NAME="$2" + shift # past argument + shift # past value + ;; + -vm-clone-id|--vm-clone-id) + VM_CLONE_ID="$2" + shift # past argument + shift # past value + ;; + -vm-mem|--vm-memory) + VM_MEM="$2" + shift # past argument + shift # past value + ;; + -vm-set|--vm-settings) + VM_SETTINGS="$2" + shift # past argument + shift # past value + ;; + -vm-keep-net|--vm-keep-network-setting) + VM_KEEP_DEFAULT_NET="true" + shift # past argument + ;; + -vm-dns|--vm-dns) + VM_DNS="$2" + shift # past argument + shift # past value + ;; + -vm-disk|--vm-disk-plus) + VM_DISK_PLUS="$2" + shift # past argument + shift # past value + ;; + -vm-start|--vm-start) + VM_START="true" + shift # past argument + ;; + # + -clean|--destroy-vm) + VM_DESTROY="true" + shift # past argument + shift # past value + ;; + -clean-clone|--destroy-vm-clone) + VM_DESTROY_CLONE="true" + shift # past argument + shift # past value + ;; + # full , clone-only, vm + -clean-type|--destroy-type) + VM_DESTROY_TYPE="$2" # default vm + shift # past argument + shift # past value + ;; + -cf-name|--cloud-init-template-name) + CLOUD_INIT_TEMPLATE_NAME="$2" + shift # past argument + shift # past value + ;; + -img-base|--image-virt-base-name) + IMAGE_NAME="$2" + shift # past argument + shift # past value + ;; + -img-custom|--image-virt-customize-name) + IMAGE_VIRT_CUSTOMIZE_NAME="$2" + shift # past argument + shift # past value + ;; +# -*|--*) +# echo "Unknown option $1" +# exit 1 +# ;; + -help|--help) + DISPLAY_USAGE="true" + shift # past argument + ;; +# -*|--*) +# echo "Unknown option $1" +# exit 1 +# ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters + +# local envs, secret path, etc. +if [ -f .envs/.env_local.sh ]; then + source .envs/.env_local.sh "$@" +else + echo "... .env_local.sh file NOT exists" +fi + +# custom envs, OS related +if [ -f .envs/.env_custom.sh ]; then + source .envs/.env_custom.sh "$@" +else + echo "... .env_custom.sh file NOT exists" +fi + +# init after OS vars +if [[ -z ${IMAGE_VIRT_CUSTOMIZE_PATH} ]]; then + export IMAGE_VIRT_CUSTOMIZE_PATH="./.images/" +fi + +if [[ -z ${IMAGE_VIRT_CUSTOMIZE_NAME} ]]; then + # rename base image + export IMAGE_VIRT_CUSTOMIZE_NAME=`echo "${IMAGE_NAME}" | sed -e "s/\.img/-custom.img/g" | sed -e "s/\.qcow2/-custom.qcow2/g"` +fi + +# pve var +if [[ -z ${PV_STORAGE_SNIPPETS_PATH} ]]; then + export PV_STORAGE_SNIPPETS_PATH="/var/lib/vz/snippets/" +fi diff --git a/.global/.env_local_example.sh b/.global/.env_local_example.sh new file mode 100644 index 0000000..2db2363 --- /dev/null +++ b/.global/.env_local_example.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export CLOUD_INIT_EXTRA= +export PV_STORAGE_ID="local-lvm" +export PV_STORAGE_TYPE="lvm" diff --git a/.global/init.sh b/.global/init.sh new file mode 100755 index 0000000..edb3c80 --- /dev/null +++ b/.global/init.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# ln -s ../../.global/init.sh . +mkdir -p ./.templates ./.envs .images/ +touch ./.images/.gitkeep + +ln -s ../../.global/.common/prepare-os.sh . +ln -s ../../.global/.common/prepare-pve.sh . + +ln -s ../../.global/.common/qm-create-vm.sh . +ln -s ../../.global/.common/qm-clone-vm.sh . + +ln -s ../../.global/.common/qm-stop-vm.sh . +ln -s ../../.global/.common/qm-destroy-vm.sh . + +# from .envs +cd ./.envs +# envs +ln -s ../../../.global/.env.sh ./.env.sh + +echo `pwd` + +if [ ! -f ./.env_local.sh ]; then + echo "... create .env_local.sh" + cat ../../../.global/.env_local_example.sh > ./.env_local.sh +else + echo "... .env_local_example.sh - file exists" +fi +cd ../ + +git add . diff --git a/.global/test.sh b/.global/test.sh new file mode 100755 index 0000000..230f429 --- /dev/null +++ b/.global/test.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +source ./.env.sh "$@" + diff --git a/.utils/.env-example.yml b/.utils/.env-example.yml new file mode 100644 index 0000000..b6c44dd --- /dev/null +++ b/.utils/.env-example.yml @@ -0,0 +1,309 @@ + +pv_list: + + ################################### ubuntu ################################################# + - name: ubuntu + os: "ubuntu" + default_os_user: "ubuntu" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "focal" + path: "focal-20.04" + img: "focal-server-cloudimg-amd64.img" + dwn: "https://cloud-images.ubuntu.com/focal/current/" + vm_ci_tpl_name: "cloud-init-ubuntu-focal-default.yml" + vm_id: 9920 + vm_clone_id: 2220 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: ubuntu + os: "ubuntu" + default_os_user: "ubuntu" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "jammy" + path: "jammy-22.04" + img: "jammy-server-cloudimg-amd64.img" + dwn: "https://cloud-images.ubuntu.com/jammy/current/" + vm_ci_tpl_name: "cloud-init-ubuntu-jammy-default.yml" + vm_id: 9930 + vm_clone_id: 2230 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: ubuntu + os: "ubuntu" + default_os_user: "ubuntu" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "noble" + path: "noble-24.04" + img: "noble-server-cloudimg-amd64.img" + dwn: "https://cloud-images.ubuntu.com/noble/current/" + vm_ci_tpl_name: "cloud-init-ubuntu-noble-default.yml" + vm_id: 9940 + vm_clone_id: 2240 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + ################################### debian ################################################# + - name: debian + os: "debian" + default_os_user: "sadmin" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "stretch" + path: "stretch-9" + img: "debian-9-generic-amd64-daily.qcow2" + dwn: "https://cloud.debian.org/images/cloud/stretch/daily/latest/" + vm_ci_tpl_name: "cloud-init-debian-stretch-default.yml" + vm_id: 9820 + vm_clone_id: 2120 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: debian + os: "debian" + default_os_user: "debian" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "buster" + path: "buster-10" + img: "debian-10-generic-amd64-daily.qcow2" + dwn: "https://cloud.debian.org/images/cloud/buster/daily/latest/" + vm_ci_tpl_name: "cloud-init-debian-buster-default.yml" + vm_id: 9821 + vm_clone_id: 2121 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: debian + os: "debian" + default_os_user: "debian" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "bullseye" + path: "bullseye-11" + img: "debian-11-generic-amd64-daily.qcow2" + dwn: "https://cloud.debian.org/images/cloud/bullseye/daily/latest/" + vm_ci_tpl_name: "cloud-init-debian-bullseye-default.yml" + vm_id: 9822 + vm_clone_id: 2122 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: debian + os: "debian" + default_os_user: "debian" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "bookworm" + path: "bookworm-12" + img: "debian-12-generic-amd64-daily.qcow2" + dwn: "https://cloud.debian.org/images/cloud/bookworm/daily/latest/" + vm_ci_tpl_name: "cloud-init-debian-bookworm-default.yml" + vm_id: 9823 + vm_clone_id: 2123 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: debian + os: "debian" + default_os_user: "debian" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "trixie" + path: "trixie-13" + img: "debian-13-generic-amd64-daily.qcow2" + dwn: "https://cloud.debian.org/images/cloud/trixie/daily/latest/" + vm_ci_tpl_name: "cloud-init-debian-trixie-default.yml" + vm_id: 9824 + vm_clone_id: 2124 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + ################################### centos ################################################# + - name: centos + os: "centos" + default_os_user: "centos" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "7" + path: "7" + img: "CentOS-7-x86_64-GenericCloud-2211.qcow2" + dwn: "https://cloud.centos.org/centos/7/images/" + vm_ci_tpl_name: "cloud-init-centos-7-default.yml" + vm_id: 9730 + vm_clone_id: 2030 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: centos + os: "centos" + default_os_user: "centos" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "8" + path: "8" + img: "CentOS-8-x86_64-GenericCloud-2211.qcow2" + dwn: "https://cloud.centos.org/centos/8/images/" + vm_ci_tpl_name: "cloud-init-centos-8-default.yml" + vm_id: 9740 + vm_clone_id: 2040 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: centos + os: "centos" + default_os_user: "centos" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "9" + path: "9" + img: "CentOS-Stream-GenericCloud-x86_64-9-latest.x86_64.qcow2" + dwn: "https://cloud.centos.org/centos/9-stream/x86_64/images/" + vm_ci_tpl_name: "cloud-init-centos-9-default.yml" + vm_id: 9750 + vm_clone_id: 2050 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + ################################### rocky ################################################# + - name: rocky + os: "rocky" + default_os_user: "sadmin" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "8" + path: "rocky-8" + img: "Rocky-8-GenericCloud-Base-8.10-20240528.0.x86_64.qcow2" + dwn: "https://download.rockylinux.org/pub/rocky/8/images/x86_64/" + vm_ci_tpl_name: "cloud-init-rocky-8-default.yml" + vm_id: 9649 + vm_clone_id: 2039 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + - name: rocky + os: "rocky" + default_os_user: "sadmin" + default_os_user_passwd: no-set + root_passwd: "please-change-me!" + family: "9" + path: "rocky-9" + img: "Rocky-9-GenericCloud-Base-9.4-20240509.0.x86_64.qcow2" + dwn: "https://download.rockylinux.org/pub/rocky/9/images/x86_64/" + vm_ci_tpl_name: "cloud-init-rocky-9-default.yml" + vm_id: 9650 + vm_clone_id: 2041 + users: + - user: user + passwd: no-set + ssh_pub: + - "no-set" + ssl: + - path: "/usr/share/ca-certificates/self/" + name: + - intermediate-ca-root.pem + - root-ca.pem + + +global_ssh_pub: + - "ssh-rsa no-set" diff --git a/.utils/.tpl/cloud-init/cloud-init-centos.yml.jinja2 b/.utils/.tpl/cloud-init/cloud-init-centos.yml.jinja2 new file mode 100644 index 0000000..e5a123c --- /dev/null +++ b/.utils/.tpl/cloud-init/cloud-init-centos.yml.jinja2 @@ -0,0 +1,81 @@ +#cloud-config +# current version: {{ os }} / {{ current_version }} +# hostname: test +manage_etc_hosts: true +user: {{ default_os_user }} +ssh_authorized_keys: +{%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} +{% endfor %} + +chpasswd: + expire: False + +groups: + - docker + +# Option 1 - create users +users: + - default + # add user and put in to groups + - name: {{ default_os_user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + {%- if default_os_user_passwd %} + passwd: {{ default_os_user_passwd }} + {% endif %} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + ssh_authorized_keys: + {%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} + {% endfor -%} + +{%- if users %} +{%- for user in users %} + - name: {{ user.user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + passwd: {{ user.passwd }} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + {%- if user.ssh_pubs %} + ssh_authorized_keys: + {%- for ssh_pub in user.ssh_pubs %} + - {{ ssh_pub -}} + {% endfor -%} + {% endif -%} +{% endfor %} +{% endif %} + +# Option 1 - Full installation using cURL +package_upgrade: true +package_update: true +package_reboot_if_required: true +locale: en_GB.UTF-8 +timezone: Europe/Minsk + +#bootcmd: +# - printf "[Resolve]\nDNS=1.1.1.1" > /etc/systemd/resolved.conf +# - [systemctl, restart, systemd-resolved] + +packages: + - qemu-guest-agent + - curl + - gnupg + - ca-certificates +# - docker.io + +runcmd: + - sed -i 's/[#]*PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config + - systemctl reload ssh + +final_message: "The system is finally up, coud init done after $UPTIME seconds" diff --git a/.utils/.tpl/cloud-init/cloud-init-debian.yml.jinja2 b/.utils/.tpl/cloud-init/cloud-init-debian.yml.jinja2 new file mode 100644 index 0000000..35664ff --- /dev/null +++ b/.utils/.tpl/cloud-init/cloud-init-debian.yml.jinja2 @@ -0,0 +1,92 @@ +#cloud-config +# current version: {{ os }} / {{ current_version }} +# hostname: test +manage_etc_hosts: true +user: {{ default_os_user }} +ssh_authorized_keys: +{%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} +{% endfor %} + +chpasswd: + expire: False + +groups: + - docker + +# Option 1 - create users +users: + - default + # add user and put in to groups + - name: {{ default_os_user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + {%- if default_os_user_passwd %} + passwd: {{ default_os_user_passwd }} + {% endif %} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + ssh_authorized_keys: + {%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} + {% endfor -%} + +{%- if users %} +{%- for user in users %} + - name: {{ user.user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + passwd: {{ user.passwd }} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + {%- if user.ssh_pubs %} + ssh_authorized_keys: + {%- for ssh_pub in user.ssh_pubs %} + - {{ ssh_pub -}} + {% endfor -%} + {% endif -%} +{% endfor %} +{% endif %} + +# Option 1 - Full installation using cURL +package_upgrade: true +package_update: true +package_reboot_if_required: true +locale: en_GB.UTF-8 +timezone: Europe/Minsk + +#bootcmd: +# - printf "[Resolve]\nDNS=1.1.1.1" > /etc/systemd/resolved.conf +# - [systemctl, restart, systemd-resolved] + +packages: + - qemu-guest-agent + - apt-transport-https + - ca-certificates + - curl + - gnupg + - lsb-release + - unattended-upgrades +# - docker.io + +runcmd: + - sed -i 's/[#]*PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config + - systemctl reload ssh + # docker + - mkdir -p /etc/apt/keyrings + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + - apt-get update + - apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + - systemctl enable docker + - systemctl start docker + +final_message: "The system is finally up, coud init done after $UPTIME seconds" diff --git a/.utils/.tpl/cloud-init/cloud-init-rocky.yml.jinja2 b/.utils/.tpl/cloud-init/cloud-init-rocky.yml.jinja2 new file mode 100644 index 0000000..e547fb0 --- /dev/null +++ b/.utils/.tpl/cloud-init/cloud-init-rocky.yml.jinja2 @@ -0,0 +1,87 @@ +#cloud-config +# current version: {{ os }} / {{ current_version }} +# hostname: test +manage_etc_hosts: true +user: {{ default_os_user }} +ssh_authorized_keys: +{%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} +{% endfor %} + +chpasswd: + expire: False + +groups: + - docker + +# Option 1 - create users +users: + - default + # add user and put in to groups + - name: {{ default_os_user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + {%- if default_os_user_passwd %} + passwd: {{ default_os_user_passwd }} + {% endif %} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + ssh_authorized_keys: + {%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} + {% endfor -%} + +{%- if users %} +{%- for user in users %} + - name: {{ user.user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + passwd: {{ user.passwd }} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + {%- if user.ssh_pubs %} + ssh_authorized_keys: + {%- for ssh_pub in user.ssh_pubs %} + - {{ ssh_pub -}} + {% endfor -%} + {% endif -%} +{% endfor %} +{% endif %} + +# Option 1 - Full installation using cURL +package_upgrade: true +package_update: true +package_reboot_if_required: true +locale: en_GB.UTF-8 +timezone: Europe/Minsk + +#bootcmd: +# - printf "[Resolve]\nDNS=1.1.1.1" > /etc/systemd/resolved.conf +# - [systemctl, restart, systemd-resolved] + +packages: + - qemu-guest-agent + - curl + - gnupg + - ca-certificates +# - docker.io + +runcmd: +# - restorecon -R /home/rocky/.ssh +# - sed -i 's/[#]*PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config + # fix client_loop: send disconnect: Broken pipe < /etc/systemd/resolved.conf +# - [systemctl, restart, systemd-resolved] + +packages: + - qemu-guest-agent + - curl + - gnupg + - lsb-release + - unattended-upgrades + - apt-transport-https + - ca-certificates +# - docker.io + +runcmd: + - sed -i 's/[#]*PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config + - systemctl reload ssh + # docker + - mkdir -p /etc/apt/keyrings + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + - apt-get update + - apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + - systemctl enable docker + - systemctl start docker + +final_message: "The system is finally up, coud init done after $UPTIME seconds" diff --git a/.utils/.tpl/cloud-init/cloud-init.yml.jinja2 b/.utils/.tpl/cloud-init/cloud-init.yml.jinja2 new file mode 100644 index 0000000..78d06fa --- /dev/null +++ b/.utils/.tpl/cloud-init/cloud-init.yml.jinja2 @@ -0,0 +1,92 @@ +#cloud-config +# current version: {{ os }} / {{ current_version }} +# hostname: test +manage_etc_hosts: true +user: {{ default_os_user }} +ssh_authorized_keys: +{%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} +{% endfor %} + +chpasswd: + expire: False + +groups: + - docker + +# Option 1 - create users +users: + - default + # add user and put in to groups + - name: {{ default_os_user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + {%- if default_os_user_passwd %} + passwd: {{ default_os_user_passwd }} + {% endif %} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + ssh_authorized_keys: + {%- for ssh_authorized_key in ssh_authorized_keys %} + - {{ ssh_authorized_key -}} + {% endfor -%} + +{%- if users %} +{%- for user in users %} + - name: {{ user.user }} + # gecos: Example User,600-700-8090 + shell: /bin/bash + lock_passwd: false + passwd: {{ user.passwd }} + groups: + - sudo + - docker + sudo: + - ALL=(ALL) NOPASSWD:ALL + {%- if user.ssh_pubs %} + ssh_authorized_keys: + {%- for ssh_pub in user.ssh_pubs %} + - {{ ssh_pub -}} + {% endfor -%} + {% endif -%} +{% endfor %} +{% endif %} + +# Option 1 - Full installation using cURL +package_upgrade: true +package_update: true +package_reboot_if_required: true +locale: en_GB.UTF-8 +timezone: Europe/Minsk + +#bootcmd: +# - printf "[Resolve]\nDNS=1.1.1.1" > /etc/systemd/resolved.conf +# - [systemctl, restart, systemd-resolved] + +packages: + - qemu-guest-agent + - curl + - gnupg + - lsb-release + - unattended-upgrades + - apt-transport-https + - ca-certificates +# - docker.io + +runcmd: + - sed -i 's/[#]*PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config + - systemctl reload ssh + # docker + - mkdir -p /etc/apt/keyrings + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + - apt-get update + - apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + - systemctl enable docker + - systemctl start docker + +final_message: "The system is finally up, coud init done after $UPTIME seconds" diff --git a/.utils/.tpl/sh/env_custom.sh.jinja2 b/.utils/.tpl/sh/env_custom.sh.jinja2 new file mode 100644 index 0000000..a70d62d --- /dev/null +++ b/.utils/.tpl/sh/env_custom.sh.jinja2 @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: {{ current_version }} +# OS dependent +## OS +export OS_DISTR_NAME="{{ os_distr_name }}" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="{{ image_name }}" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="{{ image_url }}" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="{{ os }}-{{ os_distr_name }}-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID={{ vm_id }} +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID={{ vm_clone_id }} +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="{{ os }}-{{ os_distr_name }}-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="{{ vm_ci_tpl_name }}" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/.utils/.tpl/sh/prepare-virt-customize.sh.jinja2 b/.utils/.tpl/sh/prepare-virt-customize.sh.jinja2 new file mode 100755 index 0000000..70d0b77 --- /dev/null +++ b/.utils/.tpl/sh/prepare-virt-customize.sh.jinja2 @@ -0,0 +1,105 @@ +#!/bin/bash +# current version: {{ current_version }} +source ./.envs/.env.sh $@ + +if [ ! -z "${DISPLAY_DEBUG}" ]; then + debug_cf +fi + +if [ ! -z "${DISPLAY_USAGE}" ]; then + cat << EOF +Prepare vm image with virt-customize +add to vm image + - soft + - keys + - self signed cets +usage: + ./prepare-virt-customize.sh --image-virt-customize-name debian-custom.img + + -img-base|--image-virt-base-name : set env IMAGE_NAME + -img-custom|--image-virt-customize-name : set env IMAGE_VIRT_CUSTOMIZE_NAME + +EOF +exit 1 +fi + +echo " IMAGE_VIRT_CUSTOMIZE_NAME = ${IMAGE_VIRT_CUSTOMIZE_NAME}" +echo " IMAGE_VIRT_CUSTOMIZE_PATH = ${IMAGE_VIRT_CUSTOMIZE_PATH}" +echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + + +echo "Try download image from ${IMAGE_URL}${IMAGE_NAME} to ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_NAME}" +wget -O ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_NAME} --continue ${IMAGE_URL}${IMAGE_NAME} +#wget $ubuntuImageURL --no-clobber -O ${IMAGE_NAME} + +# run first time, no image provide +if [ ! -f "${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME}" ]; then + # tmpfile=$(mktemp ./${IMAGE_NAME}-XXX.patched.img) + # cp ${IMAGE_NAME} $tmpfile + # export IMAGE_NAME=$tmpfile + echo "cp ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_NAME}" "${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME}" + cp "${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_NAME}" "${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME}" + + # update user pass, Read and set root user password from file. --password-crypto md5|sha256|sha512 + ## https://libguestfs.org/virt-builder.1.html#users-and-passwords +{%- if os in ["rocky"] %} + sudo virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --root-password password:{{ root_passwd }} --password-crypto sha512 +{% else %} + sudo virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --root-password password:{{ root_passwd }} +{%- endif %} + + # Image customization + ## Install qemu-guest-agent on the image. Additional packages can be specified by separating with a comma. +{%- if os == "ubuntu" %} + sudo virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "add-apt-repository universe" +{%- endif %} + +{%- if os in ["rocky","centos"] %} + # @todo update break image, can't login +{% else %} + sudo virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --update + # install + sudo virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --install qemu-guest-agent \ + --install mc \ + --install atool \ + --install htop \ + --install p7zip-full \ + --install iotop \ + --install ca-certificates \ + --install curl +{%- endif %} + + # custome + ## sudo virt-customize -a hirsute-server-cloudimg-amd64.img --run-command 'resize2fs /dev/sda' + +{%- if os in ["rocky","centos"] -%} +{% else %} + ## add cert + #virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "mkdir -p /etc/ssl/private/" + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "mkdir -p /usr/share/ca-certificates/self" + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --copy-in "${SERT_FOLDER_PATH}/:/usr/share/ca-certificates/" + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "mv /usr/share/ca-certificates/xen-home/* /usr/share/ca-certificates/self/" + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "rm -rf /usr/share/ca-certificates/xen-home/" + # +{%- if ssl %} + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} \ + {%- for cert in ssl["name"] %} + --run-command "mv /usr/share/ca-certificates/self/{{ cert }} /usr/share/ca-certificates/self/{{ cert | replace(".pem",".crt") }}" \ + {%- endfor %} + --run-command "chmod 755 /usr/share/ca-certificates/self" \ + --run-command "chown -R root:root /usr/share/ca-certificates/self" +{% endif %} + # + #virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "chown -R root:root /usr/share/ca-certificates/self" + + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "dpkg-reconfigure --frontend=noninteractive ca-certificates" + virt-customize -a ${IMAGE_VIRT_CUSTOMIZE_PATH}${IMAGE_VIRT_CUSTOMIZE_NAME} --run-command "sed -i 's/!//g' /etc/ca-certificates.conf" \ + --run-command "/usr/sbin/update-ca-certificates" \ + --run-command "update-ca-certificates --fresh" +{%- endif %} + +else + #echo -e "\nIMAGE_NAME=$1 " + #export IMAGE_NAME=$1 + echo "nothing to do" +fi diff --git a/.utils/cloud-init-default-gen.py b/.utils/cloud-init-default-gen.py new file mode 100644 index 0000000..866086c --- /dev/null +++ b/.utils/cloud-init-default-gen.py @@ -0,0 +1,45 @@ +import os +from jinja2 import Template +import yaml + +CURRENT_VERSION="0.0.3" +FILE_PATH = os.path.realpath(__file__) + + +with open('.env.yml', 'r') as file: + default_vars = yaml.safe_load(file) + +for key in default_vars['pv_list']: + try: + with open(f'./.tpl/cloud-init/cloud-init-{key["os"]}.yml.jinja2') as file: + template = Template(file.read()) + print(f'Open custome template: ./.tpl/cloud-init/cloud-init-{key["os"]}.yml.jinja2') + except: + print(f'Open default template') + with open(f'./.tpl/cloud-init/cloud-init.yml.jinja2') as file: + template = Template(file.read()) + + print(f' {key["os"]}-{key["family"]} {key["path"]}') + with open(f'../{key["os"]}/{key["path"]}/.templates/cloud-init-{key["os"]}-{key["family"]}-default.yml', 'w') as out: + try: + users = key["users"] + except: + users = False + try: + ssl = key["ssl"] + except: + ssl = False + out.write(template.render( + current_version=CURRENT_VERSION + "-" + key["os"], + os=key["os"], + default_os_user=key["default_os_user"], + os_distr_name=key["family"], + image_name=key["img"], + image_url=key["dwn"], + vm_id=key["vm_id"], + vm_clone_id=key["vm_clone_id"], + vm_ci_tpl_name=key["vm_ci_tpl_name"], + users=users, + ssl=ssl, + ssh_authorized_keys=default_vars["global_ssh_pub"], + )+"\n") diff --git a/.utils/env-custom-gen.py b/.utils/env-custom-gen.py new file mode 100644 index 0000000..d4caf86 --- /dev/null +++ b/.utils/env-custom-gen.py @@ -0,0 +1,29 @@ +import os +from jinja2 import Template +import yaml + +CURRENT_VERSION="0.0.2" + + +with open('.env.yml', 'r') as file: + default_vars = yaml.safe_load(file) + +with open('./.tpl/sh/env_custom.sh.jinja2') as file: + template = Template(file.read()) + +for key in default_vars['pv_list']: + print(f'{key["os"]}-{key["family"]} {key["path"]}') + with open(f'../{key["os"]}/{key["path"]}/.envs/.env_custom.sh', 'w') as out: + print(f' ../{key["os"]}/{key["path"]}/.envs/.env_custom.sh') + out.write(template.render( + current_version=CURRENT_VERSION, + os=key["os"], + default_os_user=key["default_os_user"], + os_distr_name=key["family"], + image_name=key["img"], + image_url=key["dwn"], + vm_id=key["vm_id"], + vm_clone_id=key["vm_clone_id"], + vm_ci_tpl_name=key["vm_ci_tpl_name"], + ssh_authorized_keys=default_vars["global_ssh_pub"], + )+"\n") diff --git a/.utils/prepare-virt-customize-gen.py b/.utils/prepare-virt-customize-gen.py new file mode 100644 index 0000000..f6cc979 --- /dev/null +++ b/.utils/prepare-virt-customize-gen.py @@ -0,0 +1,50 @@ +import os +from jinja2 import Template +import yaml + +CURRENT_VERSION="0.0.5" +FILE_PATH = os.path.realpath(__file__) + + +with open('.env.yml', 'r') as file: + default_vars = yaml.safe_load(file) + +for key in default_vars['pv_list']: + try: + with open(f'./.tpl/sh/prepare-virt-customize-{key["os"]}.sh.jinja2') as file: + template = Template(file.read()) + print(f'Open custome template: ./.tpl/sh/prepare-virt-customize-{key["os"]}.sh.jinja2') + except: + print(f'Open default template') + with open(f'./.tpl/sh/prepare-virt-customize.sh.jinja2') as file: + template = Template(file.read()) + + print(f'{key["os"]}-{key["family"]} {key["path"]}') + file_name=f'../{key["os"]}/{key["path"]}/prepare-virt-customize.sh' + with open(file_name, 'w') as out: + print(f' ../{key["os"]}/{key["path"]}/prepare-virt-customize.sh') + try: + users = key["users"] + except: + users = False + try: + ssl = key["ssl"][0] + except: + ssl = False + + out.write(template.render( + current_version=CURRENT_VERSION + "-" + key["os"], + os=key["os"], + default_os_user=key["default_os_user"], + os_distr_name=key["family"], + image_name=key["img"], + image_url=key["dwn"], + vm_id=key["vm_id"], + vm_clone_id=key["vm_clone_id"], + vm_ci_tpl_name=key["vm_ci_tpl_name"], + users=users, + root_passwd=key["root_passwd"], + ssl=ssl, + ssh_authorized_keys=default_vars["global_ssh_pub"], + )+"\n") + os.chmod(file_name, 0o0777) diff --git a/.utils/prepare.py b/.utils/prepare.py new file mode 100644 index 0000000..4cfdcf4 --- /dev/null +++ b/.utils/prepare.py @@ -0,0 +1,31 @@ +import os +from jinja2 import Template +import yaml +import subprocess + + +with open('.env.yml', 'r') as file: + default_vars = yaml.safe_load(file) + +for key in default_vars['pv_list']: + print(f'{key["os"]}-{key["family"]} {key["path"]}') + try: + os.mkdir(f'../{key["os"]}/{key["path"]}/') + print(f'Directory ../{key["os"]}/{key["path"]}/.templates/ created') + except: + print(f'Directory ../{key["os"]}/{key["path"]}/.templates/ exist') + try: + os.mkdir(f'../{key["os"]}/{key["path"]}/.envs/') + print(f'Directory ../{key["os"]}/{key["path"]}/.envs/ created') + except: + print(f'Directory ../{key["os"]}/{key["path"]}/.envs/ exist') + + link=""" + cd ../{os}/{path}/ + ln -s ../../.global/init.sh . || true && ./init.sh + """.format(os=key["os"], path=key["path"]) + print(link) + subprocess.run( + link, + shell=True, check=True, + executable='/bin/bash') diff --git a/.utils/re-build.sh b/.utils/re-build.sh new file mode 100755 index 0000000..3ef9016 --- /dev/null +++ b/.utils/re-build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +BASE_PATH="$(dirname -- "${BASH_SOURCE[0]}")" + +python3 "$BASE_PATH/prepare.py" +python3 cloud-init-default-gen.py +python3 env-custom-gen.py +python3 prepare-virt-customize-gen.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..943cff2 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ + +@todo: +- off certificate +- make init +- make build + +```bash +cp ./.utils +cp ./.env-example.yml ./.env.yml +bash ./re-build.sh +``` \ No newline at end of file diff --git a/centos/.common/.images/.gitkeep b/centos/.common/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/centos/7/.envs/.env.sh b/centos/7/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/centos/7/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/centos/7/.envs/.env_custom.sh b/centos/7/.envs/.env_custom.sh new file mode 100644 index 0000000..1cd77cc --- /dev/null +++ b/centos/7/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="7" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="CentOS-7-x86_64-GenericCloud-2211.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.centos.org/centos/7/images/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="centos-7-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9730 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2030 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="centos-7-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-centos-7-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/centos/7/.images/.gitkeep b/centos/7/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/centos/7/init.sh b/centos/7/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/centos/7/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/centos/7/prepare-os.sh b/centos/7/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/centos/7/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/centos/7/prepare-pve.sh b/centos/7/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/centos/7/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/centos/7/qm-clone-vm.sh b/centos/7/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/centos/7/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/centos/7/qm-create-vm.sh b/centos/7/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/centos/7/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/centos/7/qm-destroy-vm.sh b/centos/7/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/centos/7/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/centos/7/qm-stop-vm.sh b/centos/7/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/centos/7/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/centos/8/.envs/.env.sh b/centos/8/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/centos/8/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/centos/8/.envs/.env_custom.sh b/centos/8/.envs/.env_custom.sh new file mode 100644 index 0000000..c424e30 --- /dev/null +++ b/centos/8/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="8" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="CentOS-8-x86_64-GenericCloud-2211.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.centos.org/centos/8/images/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="centos-8-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9740 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2040 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="centos-8-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-centos-8-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/centos/8/.images/.gitkeep b/centos/8/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/centos/8/init.sh b/centos/8/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/centos/8/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/centos/8/prepare-os.sh b/centos/8/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/centos/8/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/centos/8/prepare-pve.sh b/centos/8/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/centos/8/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/centos/8/qm-clone-vm.sh b/centos/8/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/centos/8/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/centos/8/qm-create-vm.sh b/centos/8/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/centos/8/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/centos/8/qm-destroy-vm.sh b/centos/8/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/centos/8/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/centos/8/qm-stop-vm.sh b/centos/8/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/centos/8/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/centos/9/.envs/.env.sh b/centos/9/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/centos/9/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/centos/9/.envs/.env_custom.sh b/centos/9/.envs/.env_custom.sh new file mode 100644 index 0000000..8a244bd --- /dev/null +++ b/centos/9/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="9" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="CentOS-Stream-GenericCloud-x86_64-9-latest.x86_64.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.centos.org/centos/9-stream/x86_64/images/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="centos-9-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9750 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2050 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="centos-9-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-centos-9-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/centos/9/.images/.gitkeep b/centos/9/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/centos/9/init.sh b/centos/9/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/centos/9/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/centos/9/prepare-os.sh b/centos/9/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/centos/9/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/centos/9/prepare-pve.sh b/centos/9/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/centos/9/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/centos/9/qm-clone-vm.sh b/centos/9/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/centos/9/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/centos/9/qm-create-vm.sh b/centos/9/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/centos/9/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/centos/9/qm-destroy-vm.sh b/centos/9/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/centos/9/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/centos/9/qm-stop-vm.sh b/centos/9/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/centos/9/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/centos/BUG.md b/centos/BUG.md new file mode 100644 index 0000000..1401d28 --- /dev/null +++ b/centos/BUG.md @@ -0,0 +1,9 @@ + +Problem: +``` +Probing EDDшибка: Probing EDD (edd=off to disable)... ok +``` + +Fix: + +CPU - switch to HOST diff --git a/debian/.common/.images/.gitkeep b/debian/.common/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/bookworm-12/.envs/.env.sh b/debian/bookworm-12/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/debian/bookworm-12/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/debian/bookworm-12/.envs/.env_custom.sh b/debian/bookworm-12/.envs/.env_custom.sh new file mode 100644 index 0000000..9097b18 --- /dev/null +++ b/debian/bookworm-12/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="bookworm" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="debian-12-generic-amd64-daily.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.debian.org/images/cloud/bookworm/daily/latest/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-bookworm-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9823 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2123 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-bookworm-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-debian-bookworm-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/bookworm-12/.images/.gitkeep b/debian/bookworm-12/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/bookworm-12/init.sh b/debian/bookworm-12/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/debian/bookworm-12/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/debian/bookworm-12/prepare-os.sh b/debian/bookworm-12/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/debian/bookworm-12/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/debian/bookworm-12/prepare-pve.sh b/debian/bookworm-12/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/debian/bookworm-12/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/debian/bookworm-12/qm-clone-vm.sh b/debian/bookworm-12/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/debian/bookworm-12/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/debian/bookworm-12/qm-create-vm.sh b/debian/bookworm-12/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/debian/bookworm-12/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/debian/bookworm-12/qm-destroy-vm.sh b/debian/bookworm-12/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/debian/bookworm-12/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/debian/bookworm-12/qm-stop-vm.sh b/debian/bookworm-12/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/debian/bookworm-12/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/debian/bullseye-11/.envs/.env.sh b/debian/bullseye-11/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/debian/bullseye-11/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/debian/bullseye-11/.envs/.env_custom.sh b/debian/bullseye-11/.envs/.env_custom.sh new file mode 100644 index 0000000..a0a470e --- /dev/null +++ b/debian/bullseye-11/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="bullseye" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="debian-11-generic-amd64-daily.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.debian.org/images/cloud/bullseye/daily/latest/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-bullseye-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9822 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2122 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-bullseye-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-debian-bullseye-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/bullseye-11/.images/.gitkeep b/debian/bullseye-11/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/bullseye-11/init.sh b/debian/bullseye-11/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/debian/bullseye-11/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/debian/bullseye-11/prepare-os.sh b/debian/bullseye-11/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/debian/bullseye-11/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/debian/bullseye-11/prepare-pve.sh b/debian/bullseye-11/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/debian/bullseye-11/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/debian/bullseye-11/qm-clone-vm.sh b/debian/bullseye-11/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/debian/bullseye-11/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/debian/bullseye-11/qm-create-vm.sh b/debian/bullseye-11/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/debian/bullseye-11/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/debian/bullseye-11/qm-destroy-vm.sh b/debian/bullseye-11/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/debian/bullseye-11/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/debian/bullseye-11/qm-stop-vm.sh b/debian/bullseye-11/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/debian/bullseye-11/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/debian/buster-10/.envs/.env.sh b/debian/buster-10/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/debian/buster-10/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/debian/buster-10/.envs/.env_custom.sh b/debian/buster-10/.envs/.env_custom.sh new file mode 100644 index 0000000..fe829fa --- /dev/null +++ b/debian/buster-10/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="buster" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="debian-10-generic-amd64-daily.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.debian.org/images/cloud/buster/daily/latest/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-buster-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9821 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2121 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-buster-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-debian-buster-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/buster-10/.images/.gitkeep b/debian/buster-10/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/buster-10/.templates/debian-default.yml b/debian/buster-10/.templates/debian-default.yml new file mode 100644 index 0000000..7645f77 --- /dev/null +++ b/debian/buster-10/.templates/debian-default.yml @@ -0,0 +1,56 @@ +#!/bin/bash + +# OS dependent +## OS +export OS_DISTR_NAME="buster" + +# images +export IMAGE_NAME="debian-10-generic-amd64-daily.qcow2" +export IMAGE_URL="https://cloud.debian.org/images/cloud/buster/daily/latest/" + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-buster-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9830 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2140 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-buster-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-buster.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/buster-10/init.sh b/debian/buster-10/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/debian/buster-10/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/debian/buster-10/prepare-os.sh b/debian/buster-10/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/debian/buster-10/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/debian/buster-10/prepare-pve.sh b/debian/buster-10/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/debian/buster-10/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/debian/buster-10/qm-clone-vm.sh b/debian/buster-10/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/debian/buster-10/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/debian/buster-10/qm-create-vm.sh b/debian/buster-10/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/debian/buster-10/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/debian/buster-10/qm-destroy-vm.sh b/debian/buster-10/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/debian/buster-10/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/debian/buster-10/qm-stop-vm.sh b/debian/buster-10/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/debian/buster-10/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/debian/stretch-9/.envs/.env.sh b/debian/stretch-9/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/debian/stretch-9/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/debian/stretch-9/.envs/.env_custom.sh b/debian/stretch-9/.envs/.env_custom.sh new file mode 100644 index 0000000..faba254 --- /dev/null +++ b/debian/stretch-9/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="stretch" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="debian-9-generic-amd64-daily.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.debian.org/images/cloud/stretch/daily/latest/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-stretch-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9820 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2120 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-stretch-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-debian-stretch-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/stretch-9/.images/.gitkeep b/debian/stretch-9/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/stretch-9/init.sh b/debian/stretch-9/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/debian/stretch-9/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/debian/stretch-9/prepare-os.sh b/debian/stretch-9/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/debian/stretch-9/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/debian/stretch-9/prepare-pve.sh b/debian/stretch-9/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/debian/stretch-9/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/debian/stretch-9/qm-clone-vm.sh b/debian/stretch-9/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/debian/stretch-9/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/debian/stretch-9/qm-create-vm.sh b/debian/stretch-9/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/debian/stretch-9/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/debian/stretch-9/qm-destroy-vm.sh b/debian/stretch-9/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/debian/stretch-9/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/debian/stretch-9/qm-stop-vm.sh b/debian/stretch-9/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/debian/stretch-9/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/debian/trixie-13/.envs/.env.sh b/debian/trixie-13/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/debian/trixie-13/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/debian/trixie-13/.envs/.env_custom.sh b/debian/trixie-13/.envs/.env_custom.sh new file mode 100644 index 0000000..aa76c88 --- /dev/null +++ b/debian/trixie-13/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="trixie" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="debian-13-generic-amd64-daily.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud.debian.org/images/cloud/trixie/daily/latest/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="debian-trixie-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9824 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2124 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="debian-trixie-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-debian-trixie-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/debian/trixie-13/.images/.gitkeep b/debian/trixie-13/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/debian/trixie-13/init.sh b/debian/trixie-13/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/debian/trixie-13/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/debian/trixie-13/prepare-os.sh b/debian/trixie-13/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/debian/trixie-13/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/debian/trixie-13/prepare-pve.sh b/debian/trixie-13/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/debian/trixie-13/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/debian/trixie-13/qm-clone-vm.sh b/debian/trixie-13/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/debian/trixie-13/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/debian/trixie-13/qm-create-vm.sh b/debian/trixie-13/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/debian/trixie-13/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/debian/trixie-13/qm-destroy-vm.sh b/debian/trixie-13/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/debian/trixie-13/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/debian/trixie-13/qm-stop-vm.sh b/debian/trixie-13/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/debian/trixie-13/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/rocky/.common/.images/.gitkeep b/rocky/.common/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/rocky/.common/README.md b/rocky/.common/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/rocky/.common/README.md @@ -0,0 +1 @@ + diff --git a/rocky/rocky-8/.envs/.env.sh b/rocky/rocky-8/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/rocky/rocky-8/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/rocky/rocky-8/.envs/.env_custom.sh b/rocky/rocky-8/.envs/.env_custom.sh new file mode 100644 index 0000000..a8abbf8 --- /dev/null +++ b/rocky/rocky-8/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="8" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="Rocky-8-GenericCloud-Base-8.10-20240528.0.x86_64.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://download.rockylinux.org/pub/rocky/8/images/x86_64/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="rocky-8-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9649 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2039 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="rocky-8-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-rocky-8-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/rocky/rocky-8/.images/.gitkeep b/rocky/rocky-8/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/rocky/rocky-8/init.sh b/rocky/rocky-8/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/rocky/rocky-8/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/rocky/rocky-8/prepare-os.sh b/rocky/rocky-8/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/rocky/rocky-8/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/rocky/rocky-8/prepare-pve.sh b/rocky/rocky-8/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/rocky/rocky-8/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/rocky/rocky-8/qm-clone-vm.sh b/rocky/rocky-8/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/rocky/rocky-8/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/rocky/rocky-8/qm-create-vm.sh b/rocky/rocky-8/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/rocky/rocky-8/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/rocky/rocky-8/qm-destroy-vm.sh b/rocky/rocky-8/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/rocky/rocky-8/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/rocky/rocky-8/qm-stop-vm.sh b/rocky/rocky-8/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/rocky/rocky-8/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/rocky/rocky-9/.envs/.env.sh b/rocky/rocky-9/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/rocky/rocky-9/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/rocky/rocky-9/.envs/.env_custom.sh b/rocky/rocky-9/.envs/.env_custom.sh new file mode 100644 index 0000000..7f9dd42 --- /dev/null +++ b/rocky/rocky-9/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="9" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="Rocky-9-GenericCloud-Base-9.4-20240509.0.x86_64.qcow2" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://download.rockylinux.org/pub/rocky/9/images/x86_64/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="rocky-9-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9650 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2041 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="rocky-9-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-rocky-9-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/rocky/rocky-9/.images/.gitkeep b/rocky/rocky-9/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/rocky/rocky-9/init.sh b/rocky/rocky-9/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/rocky/rocky-9/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/rocky/rocky-9/prepare-os.sh b/rocky/rocky-9/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/rocky/rocky-9/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/rocky/rocky-9/prepare-pve.sh b/rocky/rocky-9/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/rocky/rocky-9/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/rocky/rocky-9/qm-clone-vm.sh b/rocky/rocky-9/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/rocky/rocky-9/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/rocky/rocky-9/qm-create-vm.sh b/rocky/rocky-9/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/rocky/rocky-9/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/rocky/rocky-9/qm-destroy-vm.sh b/rocky/rocky-9/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/rocky/rocky-9/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/rocky/rocky-9/qm-stop-vm.sh b/rocky/rocky-9/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/rocky/rocky-9/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/ubuntu/.common/.images/.gitkeep b/ubuntu/.common/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu/UBUNTU.md b/ubuntu/UBUNTU.md new file mode 100644 index 0000000..e2bfa56 --- /dev/null +++ b/ubuntu/UBUNTU.md @@ -0,0 +1,23 @@ +- [Ubuntu](#ubuntu) + +## Ubuntu +[DIR] bionic/ 2023-06-07 18:10 - Ubuntu Server 18.04 LTS (Bionic Beaver) daily builds +[DIR] daily/ 2023-03-13 16:39 - Daily image builds +[DIR] docs/ 2020-10-09 17:36 - +[DIR] focal/ 2024-03-07 00:31 - Ubuntu Server 20.04 LTS (Focal Fossa) daily builds +[DIR] jammy/ 2024-03-19 06:31 - Ubuntu Server 22.04 LTS (Jammy Jellyfish) daily builds +[DIR] kinetic/ 2024-03-20 14:12 - +[DIR] locator/ 2024-03-20 12:23 - Image Locator +[DIR] mantic/ 2024-03-19 23:33 - Ubuntu Server 23.10 (Mantic Minotaur) daily builds +[DIR] minimal/ 2024-03-19 23:34 - Ubuntu Server minimized image builds +[DIR] noble/ 2024-03-12 12:22 - Ubuntu Server 24.04 LTS (Noble Numbat) daily builds +[DIR] releases/ 2024-03-19 23:30 - Release image builds +[DIR] server/ 2024-03-21 11:45 - Ubuntu Server Cloud Image Builds +[DIR] trusty/ 2022-07-28 10:52 - Ubuntu Server 14.04 LTS (Trusty Tahr) daily builds [END OF STANDARD SUPPORT] +[DIR] vagrant/ 2017-01-25 14:48 - Vagrant images +[DIR] wsl/ 2024-03-05 15:38 - +[DIR] xenial/ 2023-03-14 09:53 - Ubuntu Server 16.04 LTS (Xenial Xerus) daily builds + +```bash +ubuntuImageURL=http://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64-disk-kvm.img # boot, eth error +``` \ No newline at end of file diff --git a/ubuntu/focal-20.04/.envs/.env.sh b/ubuntu/focal-20.04/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/ubuntu/focal-20.04/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/.envs/.env_custom.sh b/ubuntu/focal-20.04/.envs/.env_custom.sh new file mode 100644 index 0000000..9976d77 --- /dev/null +++ b/ubuntu/focal-20.04/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="focal" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="focal-server-cloudimg-amd64.img" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud-images.ubuntu.com/focal/current/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="ubuntu-focal-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9920 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2220 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="ubuntu-focal-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-ubuntu-focal-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/ubuntu/focal-20.04/.images/.gitkeep b/ubuntu/focal-20.04/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu/focal-20.04/init.sh b/ubuntu/focal-20.04/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/ubuntu/focal-20.04/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/prepare-os.sh b/ubuntu/focal-20.04/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/ubuntu/focal-20.04/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/prepare-pve.sh b/ubuntu/focal-20.04/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/ubuntu/focal-20.04/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/qm-clone-vm.sh b/ubuntu/focal-20.04/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/ubuntu/focal-20.04/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/qm-create-vm.sh b/ubuntu/focal-20.04/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/ubuntu/focal-20.04/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/qm-destroy-vm.sh b/ubuntu/focal-20.04/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/ubuntu/focal-20.04/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/ubuntu/focal-20.04/qm-stop-vm.sh b/ubuntu/focal-20.04/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/ubuntu/focal-20.04/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/.envs/.env.sh b/ubuntu/jammy-22.04/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/ubuntu/jammy-22.04/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/.envs/.env_custom.sh b/ubuntu/jammy-22.04/.envs/.env_custom.sh new file mode 100644 index 0000000..cb03795 --- /dev/null +++ b/ubuntu/jammy-22.04/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="jammy" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="jammy-server-cloudimg-amd64.img" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud-images.ubuntu.com/jammy/current/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="ubuntu-jammy-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9930 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2230 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="ubuntu-jammy-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-ubuntu-jammy-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/ubuntu/jammy-22.04/.images/.gitkeep b/ubuntu/jammy-22.04/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu/jammy-22.04/init.sh b/ubuntu/jammy-22.04/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/ubuntu/jammy-22.04/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/prepare-os.sh b/ubuntu/jammy-22.04/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/ubuntu/jammy-22.04/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/prepare-pve.sh b/ubuntu/jammy-22.04/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/ubuntu/jammy-22.04/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/qm-clone-vm.sh b/ubuntu/jammy-22.04/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/ubuntu/jammy-22.04/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/qm-create-vm.sh b/ubuntu/jammy-22.04/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/ubuntu/jammy-22.04/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/qm-destroy-vm.sh b/ubuntu/jammy-22.04/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/ubuntu/jammy-22.04/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/ubuntu/jammy-22.04/qm-stop-vm.sh b/ubuntu/jammy-22.04/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/ubuntu/jammy-22.04/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/.envs/.env.sh b/ubuntu/noble-24.04/.envs/.env.sh new file mode 120000 index 0000000..3c6b215 --- /dev/null +++ b/ubuntu/noble-24.04/.envs/.env.sh @@ -0,0 +1 @@ +../../../.global/.env.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/.envs/.env_custom.sh b/ubuntu/noble-24.04/.envs/.env_custom.sh new file mode 100644 index 0000000..405c916 --- /dev/null +++ b/ubuntu/noble-24.04/.envs/.env_custom.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# current version: 0.0.2 +# OS dependent +## OS +export OS_DISTR_NAME="noble" + +# images +if [[ -z ${IMAGE_NAME} ]]; then + export IMAGE_NAME="noble-server-cloudimg-amd64.img" +fi + +if [[ -z ${IMAGE_URL} ]]; then + export IMAGE_URL="https://cloud-images.ubuntu.com/noble/current/" +fi + +# VM +if [[ -z ${VM_NAME} ]]; then + export VM_NAME="ubuntu-noble-test" +fi + +if [[ -z ${VM_ID} ]]; then + export VM_ID=9940 +fi + +if [[ -z ${VM_CLONE_ID} ]]; then + export VM_CLONE_ID=2240 +fi + +if [[ -z ${VM_CLONE_NAME} ]]; then + export VM_CLONE_NAME="ubuntu-noble-clone" +fi + +if [[ -z ${VM_MEM} ]]; then + export VM_MEM=2048 +fi + +if [[ -z ${CLOUD_INIT_TEMPLATE_NAME} ]]; then + export CLOUD_INIT_TEMPLATE_NAME="cloud-init-ubuntu-noble-default.yml" +fi + +if [[ -z ${VM_SETTINGS} ]]; then + export VM_SETTINGS="--net0 virtio,bridge=vmbr0 --agent enabled=1" +fi + +if [[ -z ${VM_IPCONFIG0} ]]; then + #export VM_IPCONFIG0="ip=dhcp --nameserver=${VM_DNS}" + export VM_IPCONFIG0="ip=dhcp" + #@todo ip=192.168.0.16${VM_CLONE_ID_INC}/24 +fi + +if [[ -z ${VM_DNS} ]]; then + export VM_DNS="1.1.1.1" +fi + +if [[ -z ${VM_DESTROY_TYPE} ]]; then + export VM_DESTROY_TYPE="vm" +fi + +if [[ -z ${SERT_FOLDER_PATH} ]]; then + export SERT_FOLDER_PATH="./keys/ssl/k8s/xen-home" +fi diff --git a/ubuntu/noble-24.04/.images/.gitkeep b/ubuntu/noble-24.04/.images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu/noble-24.04/init.sh b/ubuntu/noble-24.04/init.sh new file mode 120000 index 0000000..125dc2b --- /dev/null +++ b/ubuntu/noble-24.04/init.sh @@ -0,0 +1 @@ +../../.global/init.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/prepare-os.sh b/ubuntu/noble-24.04/prepare-os.sh new file mode 120000 index 0000000..6c3ef8a --- /dev/null +++ b/ubuntu/noble-24.04/prepare-os.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-os.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/prepare-pve.sh b/ubuntu/noble-24.04/prepare-pve.sh new file mode 120000 index 0000000..13a0250 --- /dev/null +++ b/ubuntu/noble-24.04/prepare-pve.sh @@ -0,0 +1 @@ +../../.global/.common/prepare-pve.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/qm-clone-vm.sh b/ubuntu/noble-24.04/qm-clone-vm.sh new file mode 120000 index 0000000..ccf0227 --- /dev/null +++ b/ubuntu/noble-24.04/qm-clone-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-clone-vm.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/qm-create-vm.sh b/ubuntu/noble-24.04/qm-create-vm.sh new file mode 120000 index 0000000..c067ba8 --- /dev/null +++ b/ubuntu/noble-24.04/qm-create-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-create-vm.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/qm-destroy-vm.sh b/ubuntu/noble-24.04/qm-destroy-vm.sh new file mode 120000 index 0000000..6742c52 --- /dev/null +++ b/ubuntu/noble-24.04/qm-destroy-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-destroy-vm.sh \ No newline at end of file diff --git a/ubuntu/noble-24.04/qm-stop-vm.sh b/ubuntu/noble-24.04/qm-stop-vm.sh new file mode 120000 index 0000000..d2e3ff1 --- /dev/null +++ b/ubuntu/noble-24.04/qm-stop-vm.sh @@ -0,0 +1 @@ +../../.global/.common/qm-stop-vm.sh \ No newline at end of file