pulumi-templates/proxmoxve-python/__main__.py

76 lines
2.2 KiB
Python
Raw Normal View History

2022-08-17 01:52:53 +02:00
"""A Pulumi-based infrastructure with Proxmox VE and Python"""
import pulumi
import pulumi_proxmoxve as proxmox
config = pulumi.Config()
2022-08-17 02:19:17 +02:00
data = config.require_object("pve")
2022-08-17 01:52:53 +02:00
2022-08-17 02:16:30 +02:00
provider = proxmox.Provider("proxmoxve",
virtual_environment = {
"endpoint": data.get("endpoint"),
"insecure": True,
"username": "root@pam",
2022-08-17 02:22:24 +02:00
"password": data.get("password")
2022-08-17 02:16:30 +02:00
}
)
2022-08-17 01:52:53 +02:00
vm = proxmox.vm.VirtualMachine("vm",
name = "virtual-machine",
2022-08-17 02:16:30 +02:00
node_name = data.get("node_name"),
2022-08-17 01:52:53 +02:00
agent = proxmox.vm.VirtualMachineAgentArgs(
enabled = True,
trim = True,
type = "virtio"
),
bios = "seabios",
cpu = proxmox.vm.VirtualMachineCpuArgs(
cores = 1,
sockets = 1
),
memory = proxmox.vm.VirtualMachineMemoryArgs(
dedicated = 2048
),
clone = proxmox.vm.VirtualMachineCloneArgs(
2022-08-17 02:16:30 +02:00
node_name = data.require("node_name"),
vm_id = config.require("clonevm"),
full = True
2022-08-17 01:52:53 +02:00
),
disks = [
proxmox.vm.VirtualMachineDiskArgs(
interface = "virtio0",
datastore_id = "local-lvm",
size = 20,
file_format = "qcow2"
)
],
2022-08-17 01:52:53 +02:00
network_devices = [
proxmox.vm.VirtualMachineNetworkDeviceArgs(
bridge = "vmbr0",
model = "virtio"
)
],
on_boot = True,
operating_system = proxmox.vm.VirtualMachineOperatingSystemArgs(
type = "l26"
),
initialization = proxmox.vm.VirtualMachineInitializationArgs(
type = "nocloud",
datastore_id = "local-lvm",
user_account = proxmox.vm.VirtualMachineInitializationUserAccountArgs(
username = "syntaxerrormmm",
password = "cicciopasticcio",
keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFioHkaV1NhX6NCqsJakJw8EVBOcDHm1MEbpY499CPtG syntaxerrormmm@fisso",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP/hn/0xn6DRS2B0paFzDQRakupgTQQ5hitQhqOfWcqz syntaxerrormmm@microbo"
]
)
),
2022-08-17 02:19:17 +02:00
opts = pulumi.ResourceOptions(
provider = provider
)
2022-08-17 01:52:53 +02:00
)
pulumi.export("ip", vm.ipv4_address)