Selezione più rapida per immagine con libvirt.

This commit is contained in:
Emiliano Vavassori 2023-07-03 21:05:54 +02:00
parent 300e92dcb5
commit ff2f4252e4
6 changed files with 12 additions and 4 deletions

View File

@ -9,6 +9,7 @@ from jinja2 import Template
from passlib.hash import sha512_crypt
conf = DotMap(yaml.safe_load(open("./input.yaml", "r").read()))
cloudimages = DotMap(yaml.safe_load(open('cloud-images.yaml').read()))
# Replacing readed password with its own counterpart.
conf.password = sha512_crypt.hash(conf.password, rounds=4096)
@ -22,7 +23,7 @@ pool = lv.Pool("pool",
baseimg = lv.Volume("base-image",
pool = pool.name,
source = conf.image_url
source = cloudimages[conf.image]
#source = "https://cdimage.debian.org/images/cloud/bullseye-backports/20220711-1073/debian-11-backports-generic-amd64-20220711-1073.qcow2"
)

View File

@ -0,0 +1,3 @@
buster: https://cloud.debian.org/images/cloud/buster-backports/latest/debian-10-backports-generic-amd64.qcow2
bullseye: https://cloud.debian.org/images/cloud/bullseye-backports/latest/debian-11-backports-generic-amd64.qcow2
bookworm: https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2

View File

@ -11,7 +11,7 @@ sshkeys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP/hn/0xn6DRS2B0paFzDQRakupgTQQ5hitQhqOfWcqz syntaxerrormmm@microbo"
image_url: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
image: bookworm
poolpath: /var/tmp/libvirt/pulumi
# Ansible configuration

View File

@ -8,11 +8,12 @@ from passlib.hash import sha512_crypt
from jinja2 import Template
conf = DotMap(yaml.safe_load(open("input.yaml").read()))
cloudimages = DotMap(yaml.safe_load(open("cloud-images.yaml").read()))
conf.password = sha512_crypt.hash(conf.password, rounds=4096)
config = pulumi.Config()
pool = lv.Pool("mypool", type = "dir", path = conf.poolpath)
baseimg = lv.Volume("myimage", pool = pool.name, source = conf.image_url)
baseimg = lv.Volume("myimage", pool = pool.name, source = cloudimages[conf.image])
volume = lv.Volume("mydisk",
base_volume_id = baseimg.id,

View File

@ -0,0 +1,3 @@
buster: https://cloud.debian.org/images/cloud/buster-backports/latest/debian-10-backports-generic-amd64.qcow2
bullseye: https://cloud.debian.org/images/cloud/bullseye-backports/latest/debian-11-backports-generic-amd64.qcow2
bookworm: https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2

View File

@ -11,5 +11,5 @@ sshkeys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP/hn/0xn6DRS2B0paFzDQRakupgTQQ5hitQhqOfWcqz syntaxerrormmm@microbo"
image_url: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
image: bookworm
poolpath: /var/tmp/libvirt/pulumi