Renaming projects for quick retrieval.
This commit is contained in:
parent
9b8c772615
commit
fbf68c67b9
43 changed files with 112 additions and 1 deletions
2
pvm/.gitignore
vendored
Normal file
2
pvm/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.pyc
|
||||
venv/
|
6
pvm/Pulumi.yaml
Normal file
6
pvm/Pulumi.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
name: ${PROJECT}
|
||||
description: ${DESCRIPTION}
|
||||
runtime: python
|
||||
template:
|
||||
description: A ProxmoxVE VM template with Python
|
7
pvm/README.md
Normal file
7
pvm/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Quick configuration #
|
||||
|
||||
Check out the file `input.yml` for a quick setup for a new machine.
|
||||
Also, don't forget to setup the password for your account on your ProxmoxVE
|
||||
server configuring `pulumi`:
|
||||
|
||||
$ pulumi config set password --secret yourpvepassword
|
76
pvm/__main__.py
Normal file
76
pvm/__main__.py
Normal file
|
@ -0,0 +1,76 @@
|
|||
"""A ProxmoxVE VM template with Python"""
|
||||
|
||||
import yaml
|
||||
from dotmap import DotMap
|
||||
import pulumi
|
||||
import pulumi_proxmoxve as proxmox
|
||||
|
||||
conf = DotMap(yaml.safe_load(open("input.yaml").read()))
|
||||
config = pulumi.Config()
|
||||
|
||||
provider = proxmox.Provider("proxmoxve",
|
||||
virtual_environment = {
|
||||
"endpoint": conf.pve.url,
|
||||
"insecure": conf.pve.insecure,
|
||||
"username": conf.pve.username,
|
||||
"password": config.require_secret("password")
|
||||
}
|
||||
)
|
||||
|
||||
vm = proxmox.vm.VirtualMachine(conf.vm.name,
|
||||
node_name = conf.pve.nodename,
|
||||
agent = proxmox.vm.VirtualMachineAgentArgs(
|
||||
enabled = True,
|
||||
trim = True,
|
||||
type = "virtio"
|
||||
),
|
||||
bios = "seabios",
|
||||
cpu = proxmox.vm.VirtualMachineCpuArgs(
|
||||
cores = conf.vm.cores,
|
||||
sockets = conf.vm.sockets
|
||||
),
|
||||
memory = proxmox.vm.VirtualMachineMemoryArgs(
|
||||
dedicated = conf.vm.ram
|
||||
),
|
||||
clone = proxmox.vm.VirtualMachineCloneArgs(
|
||||
node_name = conf.pve.nodename,
|
||||
vm_id = conf.vm.clone,
|
||||
full = True
|
||||
),
|
||||
disks = [
|
||||
proxmox.vm.VirtualMachineDiskArgs(
|
||||
interface = "virtio0",
|
||||
datastore_id = conf.pve.storage,
|
||||
size = conf.vm.disksize,
|
||||
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 = conf.pve.storage,
|
||||
user_account = proxmox.vm.VirtualMachineInitializationUserAccountArgs(
|
||||
username = conf.vm.username,
|
||||
password = conf.vm.password,
|
||||
keys = conf.vm.sshkeys
|
||||
)
|
||||
),
|
||||
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)
|
22
pvm/input.yaml
Normal file
22
pvm/input.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
pve:
|
||||
url: "https://pve.vavassori.lcl:8006"
|
||||
insecure: true
|
||||
username: root@pam
|
||||
nodename: pve
|
||||
storage: local-lvm
|
||||
|
||||
# Basic VM configuration
|
||||
vm:
|
||||
name: virtual-machine
|
||||
clone: 802
|
||||
sockets: 1
|
||||
cores: 1
|
||||
ram: 2048
|
||||
disksize: 20
|
||||
username: syntaxerrormmm
|
||||
password: cicciopasticcio
|
||||
sshkeys:
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFioHkaV1NhX6NCqsJakJw8EVBOcDHm1MEbpY499CPtG syntaxerrormmm@fisso"
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps"
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP/hn/0xn6DRS2B0paFzDQRakupgTQQ5hitQhqOfWcqz syntaxerrormmm@microbo"
|
5
pvm/requirements.txt
Normal file
5
pvm/requirements.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
pyyaml>=6.0
|
||||
protobuf==3.20.1
|
||||
pulumi>=3.0.0,<4.0.0
|
||||
pulumi-proxmoxve>=2.0.0
|
||||
dotmap>=1.3.30
|
Loading…
Add table
Add a link
Reference in a new issue