Selezione più rapida per immagine con libvirt.
This commit is contained in:
parent
300e92dcb5
commit
ff2f4252e4
@ -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"
|
||||
)
|
||||
|
||||
|
3
libvirt-ansible-python/cloud-images.yaml
Normal file
3
libvirt-ansible-python/cloud-images.yaml
Normal 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
|
@ -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
|
||||
|
@ -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,
|
||||
|
3
libvirt-python/cloud-images.yaml
Normal file
3
libvirt-python/cloud-images.yaml
Normal 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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user