Aggiornato template con ultime impostazioni e test.
This commit is contained in:
parent
6a6327b4c5
commit
4059be838d
@ -2,5 +2,10 @@
|
||||
name: ${PROJECT}
|
||||
description: ${DESCRIPTION}
|
||||
runtime: python
|
||||
|
||||
template:
|
||||
description: ProxmoxVE provider, Ansible powered with Python
|
||||
config:
|
||||
password:
|
||||
description: Password of the root user over PVE.
|
||||
secret: true
|
||||
|
@ -1,3 +1,6 @@
|
||||
[![Deploy with Pulumi](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new?template=https://git.sys42.eu/syntaxerrormmm/pulumi-templates/src/branch/main/pvm-ansible)
|
||||
|
||||
|
||||
# Quick configuration #
|
||||
|
||||
Check out the file `input.yml` for a quick setup for a new machine.
|
||||
|
@ -4,29 +4,28 @@ import pulumi
|
||||
import pulumi_proxmoxve as proxmox
|
||||
import pulumi_command as command
|
||||
import yaml
|
||||
from dotmap import DotMap
|
||||
|
||||
# Import configuration parameters from input.yaml
|
||||
i = open("./input.yaml")
|
||||
input_ = yaml.safe_load(i.read())
|
||||
i.close()
|
||||
input_ = DotMap(yaml.safe_load(open("./input.yaml", "r").read()))
|
||||
|
||||
# Check pulumi configuration
|
||||
config = pulumi.Config()
|
||||
|
||||
provider = proxmox.Provider("proxmoxve",
|
||||
endpoint=input_['pve']['url'],
|
||||
insecure=input_['pve']['insecure'],
|
||||
username=input_['pve']['username'],
|
||||
endpoint=input_.pve.url,
|
||||
insecure=input_.pve.insecure,
|
||||
username=input_.pve.username,
|
||||
password=config.require_secret("password")
|
||||
)
|
||||
|
||||
vm_name = input_['vm']['name']
|
||||
vm_username = input_['vm']['username']
|
||||
ansible_playbook = input_['ansible_playbook']
|
||||
vm_name = input_.vm.name
|
||||
vm_username = input_.vm.username
|
||||
ansible_playbook = input_.ansible_playbook
|
||||
|
||||
vm = proxmox.vm.VirtualMachine("vm",
|
||||
name = vm_name,
|
||||
node_name = input_['pve']['nodename'],
|
||||
node_name = input_.pve.nodename,
|
||||
agent = proxmox.vm.VirtualMachineAgentArgs(
|
||||
enabled = True,
|
||||
trim = True,
|
||||
@ -34,22 +33,20 @@ vm = proxmox.vm.VirtualMachine("vm",
|
||||
),
|
||||
bios = "seabios",
|
||||
cpu = proxmox.vm.VirtualMachineCpuArgs(
|
||||
cores = input_['vm']['cores'],
|
||||
sockets = input_['vm']['sockets']
|
||||
),
|
||||
memory = proxmox.vm.VirtualMachineMemoryArgs(
|
||||
dedicated = input_['vm']['ram']
|
||||
cores = input_.vm.cores,
|
||||
sockets = input_.vm.sockets
|
||||
),
|
||||
memory = proxmox.vm.VirtualMachineMemoryArgs(dedicated = input_.vm.ram),
|
||||
clone = proxmox.vm.VirtualMachineCloneArgs(
|
||||
node_name = input_['pve']['nodename'],
|
||||
vm_id = input_['vm']['clone'],
|
||||
node_name = input_.pve.nodename,
|
||||
vm_id = input_.vm.clone,
|
||||
full = True
|
||||
),
|
||||
disks = [
|
||||
proxmox.vm.VirtualMachineDiskArgs(
|
||||
interface = "virtio0",
|
||||
datastore_id = input_['pve']['storage'],
|
||||
size = input_['vm']['disksize'],
|
||||
datastore_id = input_.pve.storage,
|
||||
size = input_.vm.disksize,
|
||||
file_format = "raw"
|
||||
)
|
||||
],
|
||||
@ -65,11 +62,11 @@ vm = proxmox.vm.VirtualMachine("vm",
|
||||
),
|
||||
initialization = proxmox.vm.VirtualMachineInitializationArgs(
|
||||
type = "nocloud",
|
||||
datastore_id = input_['pve']['storage'],
|
||||
datastore_id = input_.pve.storage,
|
||||
user_account = proxmox.vm.VirtualMachineInitializationUserAccountArgs(
|
||||
username = vm_username,
|
||||
password = input_['vm']['password'],
|
||||
keys = input_['vm']['sshkeys']
|
||||
password = input_.vm.password,
|
||||
keys = input_.vm.sshkeys
|
||||
)
|
||||
),
|
||||
opts = pulumi.ResourceOptions(
|
||||
|
@ -20,6 +20,7 @@ vm:
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFioHkaV1NhX6NCqsJakJw8EVBOcDHm1MEbpY499CPtG syntaxerrormmm@fisso"
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps"
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILH5q/ObtC4VhNT88gebezP/svpvCoQLoZCh4DvUn4xq syntaxerrormmm@taz"
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGdTHkPCPUhvrcGgU9M6/BaEeirStM/kBnFxsLyXyelt syntaxerrormmm@kurotsuchi"
|
||||
|
||||
# Ansible configuration
|
||||
ansible_playbook: deploy.yml
|
||||
|
@ -1,3 +1,4 @@
|
||||
pulumi>=3.0.0,<4.0.0
|
||||
pulumi-proxmoxve>=2.0.0
|
||||
pulumi-command>=0.4.1
|
||||
dotmap>=1.3.30
|
||||
|
Loading…
Reference in New Issue
Block a user