Cambio nomi per template.
This commit is contained in:
parent
d5779c819d
commit
b216e3361e
12 changed files with 0 additions and 0 deletions
2
pve-vm-python/.gitignore
vendored
Normal file
2
pve-vm-python/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.pyc
|
||||
venv/
|
5
pve-vm-python/Pulumi.yaml
Normal file
5
pve-vm-python/Pulumi.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
name: ${PROJECT}
|
||||
description: ${DESCRIPTION}
|
||||
runtime: python
|
||||
template:
|
||||
description: A minimal Python Pulumi program
|
79
pve-vm-python/__main__.py
Normal file
79
pve-vm-python/__main__.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
"""A Pulumi-based infrastructure with Proxmox VE and Python"""
|
||||
|
||||
import pulumi
|
||||
import pulumi_proxmoxve as proxmox
|
||||
|
||||
config = pulumi.Config()
|
||||
data = config.require_object("pve")
|
||||
|
||||
provider = proxmox.Provider("proxmoxve",
|
||||
virtual_environment = {
|
||||
"endpoint": data.get("endpoint"),
|
||||
"insecure": True,
|
||||
"username": "root@pam",
|
||||
"password": data.get("password")
|
||||
}
|
||||
)
|
||||
|
||||
vm = proxmox.vm.VirtualMachine("vm",
|
||||
name = "virtual-machine",
|
||||
node_name = data.get("node_name"),
|
||||
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(
|
||||
node_name = data.get("node_name"),
|
||||
vm_id = config.require("clonevm"),
|
||||
full = True
|
||||
),
|
||||
disks = [
|
||||
proxmox.vm.VirtualMachineDiskArgs(
|
||||
interface = "virtio0",
|
||||
datastore_id = "local-lvm",
|
||||
size = 20,
|
||||
file_format = "qcow2"
|
||||
)
|
||||
],
|
||||
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"
|
||||
]
|
||||
)
|
||||
),
|
||||
opts = pulumi.ResourceOptions(
|
||||
provider = provider
|
||||
)
|
||||
)
|
||||
|
||||
# Getting local IP
|
||||
# First item of the ipv4_addresses is of the loopback interface (so the usual 127.0.0.1). Let's get the second and grab only the text.
|
||||
lanip = vm.ipv4_addresses[1][0]
|
||||
|
||||
pulumi.export("ip", lanip)
|
2
pve-vm-python/requirements.txt
Normal file
2
pve-vm-python/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
pulumi>=3.0.0,<4.0.0
|
||||
pulumi-proxmoxve>=2.0.0
|
Loading…
Add table
Add a link
Reference in a new issue