Renaming projects for quick retrieval.
This commit is contained in:
parent
9b8c772615
commit
fbf68c67b9
@ -1,3 +1,3 @@
|
|||||||
# pulumi-templates
|
# pulumi-templates
|
||||||
|
|
||||||
Templates for new projects for Pulumi
|
Templates for new projects for Pulumi.
|
||||||
|
70
pve-ct-python/__main__.py
Normal file
70
pve-ct-python/__main__.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
"""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")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
ct = proxmox.ct.Container(conf.ct.name,
|
||||||
|
clone = proxmox.ct.ContainerCloneArgs(
|
||||||
|
vm_id = conf.ct.clone,
|
||||||
|
full = True
|
||||||
|
),
|
||||||
|
console = proxmox.ct.ConsoleArgs(
|
||||||
|
type = "serial",
|
||||||
|
tty_count = 1,
|
||||||
|
enabled = True
|
||||||
|
),
|
||||||
|
cpu = proxmox.ct.ContainerCpuArgs(cores = conf.ct.cores),
|
||||||
|
disk = proxmox.ct.ContainerDiskArgs(datastore_id = conf.pve.storage),
|
||||||
|
initialization = proxmox.ct.ContainerInitializationArgs(
|
||||||
|
hostname = conf.ct.name,
|
||||||
|
ip_configs = [
|
||||||
|
proxmox.ct.ContainerInitializationIpConfigArgs(
|
||||||
|
ipv4 = proxmox.ct.ContainerInitializationIpConfigIpv4Args(
|
||||||
|
address = "dhcp"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
user_account = proxmox.ct.ContainerInitializationUserAccountArgs(
|
||||||
|
password = conf.ct.password,
|
||||||
|
keys = conf.ct.sshkeys
|
||||||
|
),
|
||||||
|
),
|
||||||
|
memory = proxmox.ct.ContainerMemoryArgs(
|
||||||
|
dedicated = conf.ct.ram,
|
||||||
|
swap = conf.ct.ram
|
||||||
|
),
|
||||||
|
network_interfaces = [
|
||||||
|
proxmox.ct.ContainerNetworkInterfaceArgs("mynic",
|
||||||
|
bridge = "vmbr0",
|
||||||
|
enabled = True
|
||||||
|
)
|
||||||
|
],
|
||||||
|
node_name = conf.pve.nodename,
|
||||||
|
operating_system = proxmox.ct.ContainerOperatingSystemArgs(
|
||||||
|
template_file_id = "debian-11-standard_11.3-1_amd64.tar.zst"
|
||||||
|
),
|
||||||
|
started = True,
|
||||||
|
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 = ct.initialization["ip_configs"]["ipv4"]["address"][0]
|
||||||
|
|
||||||
|
pulumi.export("ip", lanip)
|
21
pve-ct-python/input.yaml
Normal file
21
pve-ct-python/input.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
pve:
|
||||||
|
url: "https://pve.vavassori.lcl:8006"
|
||||||
|
insecure: true
|
||||||
|
username: root@pam
|
||||||
|
nodename: pve
|
||||||
|
storage: local
|
||||||
|
|
||||||
|
# Basic VM configuration
|
||||||
|
ct:
|
||||||
|
name: virtual-machine
|
||||||
|
clone: 802
|
||||||
|
sockets: 1
|
||||||
|
cores: 1
|
||||||
|
ram: 2048
|
||||||
|
disksize: 20
|
||||||
|
password: cicciopasticcio
|
||||||
|
sshkeys:
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFioHkaV1NhX6NCqsJakJw8EVBOcDHm1MEbpY499CPtG syntaxerrormmm@fisso"
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps"
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP/hn/0xn6DRS2B0paFzDQRakupgTQQ5hitQhqOfWcqz syntaxerrormmm@microbo"
|
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
|
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
|
2
vm/.gitignore
vendored
Normal file
2
vm/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.pyc
|
||||||
|
venv/
|
Loading…
Reference in New Issue
Block a user