From 792cedd07eda04ae968fc48f0f1c5bf950454810 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 3 Jan 2022 17:38:23 +0100 Subject: [PATCH] Cloud-init --- sio2/sisr/55-proxmox/clone.sh | 9 +++++++++ sio2/sisr/55-proxmox/create.sh | 16 ++++++++++++++++ sio2/sisr/55-proxmox/id_rsa.pub | 1 + sio2/sisr/55-proxmox/pubkey/id_rsa.pub | 1 + 4 files changed, 27 insertions(+) create mode 100755 sio2/sisr/55-proxmox/clone.sh create mode 100755 sio2/sisr/55-proxmox/create.sh create mode 100644 sio2/sisr/55-proxmox/id_rsa.pub create mode 100644 sio2/sisr/55-proxmox/pubkey/id_rsa.pub diff --git a/sio2/sisr/55-proxmox/clone.sh b/sio2/sisr/55-proxmox/clone.sh new file mode 100755 index 0000000..840e8f8 --- /dev/null +++ b/sio2/sisr/55-proxmox/clone.sh @@ -0,0 +1,9 @@ +#!/bin/bash +num1="$1" +num2="$2" +nom="$3" +ip="$4" + +qm clone "${num1}" "${num2}" --name "${nom}" +qm set "${num2}" --sshkeys id_rsa.pub +qm set "${num2}" --ipconfig0 ip="${ip}",gw=192.168.0.1 diff --git a/sio2/sisr/55-proxmox/create.sh b/sio2/sisr/55-proxmox/create.sh new file mode 100755 index 0000000..c05d739 --- /dev/null +++ b/sio2/sisr/55-proxmox/create.sh @@ -0,0 +1,16 @@ +#!/bin/bash +num="$1" +#récupération de l'image Openstack Debian 11 au format qcow2 +cd /var/lib/vz/template/qemu/ +export http_proxy=http://10.121.38.1:8080 +export https_proxy=http://10.121.38.1:8080 +wget --no-check-certificate https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2 +#Création de la VM a partir de l'image +qm create "${num}" --memory 1024 --net0 virtio,bridge=vmbr0 +qm importdisk "${num}" /var/lib/vz/template/qemu/debian-11-generic-amd64.qcow2 local-lvm +#Paramètrage de la machine +qm set "${num}" --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-"${num}"-disk-0 # on associe le disque scsi0 au LV vm-9000-disk-0 +qm set "${num}" --boot c --bootdisk scsi0 # on définit le disque scsi0 comme disque de démarrage +qm set "${num}" --ide2 local-lvm:cloudinit # on joint le volume CDROM cloudinit utilisé pour le démarrage +qm set "${num}" --serial0 socket --vga serial0 # on définit une console série qu'on utilise comme affichage +qm template "${num}" # on définit la VM 9000 comme template diff --git a/sio2/sisr/55-proxmox/id_rsa.pub b/sio2/sisr/55-proxmox/id_rsa.pub new file mode 100644 index 0000000..8992978 --- /dev/null +++ b/sio2/sisr/55-proxmox/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCh2egCAcgBM+XXtvBfg6QYHB5+c0jqN1gzcfcs/2SaP/FTWk6u5mv+E9igbpMHrQKkH8z0ocNgKhV8nAHbtbCFa9UOF7kUESSnMWb6gt9qSiVY3PHb9iQHAbpQkqWgCgUKUTp7UEFLPd1QaCAFvbv43nGZGAFod/lX5h3HQV5goAyWgwairJbFSekkEvAF6hDFzaTSZaoi8tRRKDBDZVmTsL4v4ywM6/SIl/8COK0FJmEwIjU8jSOUAQtmbwXH70Zbegh30Osg8xLdnNrWJCKC9onf0V8s8djongk7wgj0KTBTrpPf26f9imY6Is24paHTGAFEfaqjhPyIz+i2hZKKMT5K5j0QYKOsThiReJs59cJIJpPgysbKnkNNMbhHtSL0XENmlhXzsKgfVVwTcvopE7+yoe1suCsqBrWtUw9o8RpHmzFrLH9HHJ5Ts1JCyMnTg10LzXlyK2ukWMbb0+qc0PMJrANTmpf77mJulkblQaOKSV38S5awS44NCZPRIbs= sio@lab213-23 diff --git a/sio2/sisr/55-proxmox/pubkey/id_rsa.pub b/sio2/sisr/55-proxmox/pubkey/id_rsa.pub new file mode 100644 index 0000000..8992978 --- /dev/null +++ b/sio2/sisr/55-proxmox/pubkey/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCh2egCAcgBM+XXtvBfg6QYHB5+c0jqN1gzcfcs/2SaP/FTWk6u5mv+E9igbpMHrQKkH8z0ocNgKhV8nAHbtbCFa9UOF7kUESSnMWb6gt9qSiVY3PHb9iQHAbpQkqWgCgUKUTp7UEFLPd1QaCAFvbv43nGZGAFod/lX5h3HQV5goAyWgwairJbFSekkEvAF6hDFzaTSZaoi8tRRKDBDZVmTsL4v4ywM6/SIl/8COK0FJmEwIjU8jSOUAQtmbwXH70Zbegh30Osg8xLdnNrWJCKC9onf0V8s8djongk7wgj0KTBTrpPf26f9imY6Is24paHTGAFEfaqjhPyIz+i2hZKKMT5K5j0QYKOsThiReJs59cJIJpPgysbKnkNNMbhHtSL0XENmlhXzsKgfVVwTcvopE7+yoe1suCsqBrWtUw9o8RpHmzFrLH9HHJ5Ts1JCyMnTg10LzXlyK2ukWMbb0+qc0PMJrANTmpf77mJulkblQaOKSV38S5awS44NCZPRIbs= sio@lab213-23