Initialer Import der Synology Scripts
This commit is contained in:
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
+56
@@ -0,0 +1,56 @@
|
||||
[
|
||||
{
|
||||
"Disk Storage": "CEPH-SSD FRONT",
|
||||
"Memory": 1024,
|
||||
"Gateway(IPv6)": false,
|
||||
"Gateway(IPv4)": "10.10.10.254",
|
||||
"Template": "debian-13-standard_13.1-2_amd64.tar.zst",
|
||||
"DNS Server": false,
|
||||
"Password": "Password",
|
||||
"Model": false,
|
||||
"Nesting": true,
|
||||
"Cores": 2,
|
||||
"Unprivileged": true,
|
||||
"Disks": [],
|
||||
"Bridge": "CENTRAL",
|
||||
"Firewall": false,
|
||||
"IPv6 Mode": false,
|
||||
"Swap": 512,
|
||||
"Template Storage": "ISO ALL",
|
||||
"Hostname": "pdc",
|
||||
"DNS Domain": false,
|
||||
"IPv6/CIDR": false,
|
||||
"Node": "fhs0",
|
||||
"VLAN Tag": false,
|
||||
"IPv4 Mode": "Static",
|
||||
"IPv4/CIDR": "10.10.10.1/24",
|
||||
"CT ID": 356
|
||||
},
|
||||
{
|
||||
"Disk Storage": "CEPH-SSD FRONT",
|
||||
"Memory": 1024,
|
||||
"Gateway(IPv6)": false,
|
||||
"Gateway(IPv4)": "10.10.20.254",
|
||||
"Template": "ubuntu-25.04-standard_25.04-1.1_amd64.tar.zst",
|
||||
"DNS Server": false,
|
||||
"Password": "Password",
|
||||
"Model": false,
|
||||
"Nesting": true,
|
||||
"Cores": 2,
|
||||
"Unprivileged": true,
|
||||
"Disks": [],
|
||||
"Bridge": "CERT",
|
||||
"Firewall": false,
|
||||
"IPv6 Mode": false,
|
||||
"Swap": 512,
|
||||
"Template Storage": "ISO ALL",
|
||||
"Hostname": "sdc",
|
||||
"DNS Domain": false,
|
||||
"IPv6/CIDR": false,
|
||||
"Node": "fhs1",
|
||||
"VLAN Tag": false,
|
||||
"IPv4 Mode": false,
|
||||
"IPv4/CIDR": "10.10.20.1/24",
|
||||
"CT ID": 357
|
||||
}
|
||||
]
|
||||
Executable
BIN
Binary file not shown.
Executable
+85
@@ -0,0 +1,85 @@
|
||||
param(
|
||||
[string]$InputFile,
|
||||
[string]$OutputVM = "vm_output.json",
|
||||
[string]$OutputCT = "ct_output.json"
|
||||
)
|
||||
|
||||
# Pfad Resolution
|
||||
$basePath = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
|
||||
if (-not $InputFile) { $InputFile = Join-Path $basePath "vm_list.xlsx" }
|
||||
$OutputVM = Join-Path $basePath $OutputVM
|
||||
$OutputCT = Join-Path $basePath $OutputCT
|
||||
|
||||
Write-Host "Using Excel file: $InputFile"
|
||||
|
||||
# ImportExcel Modul prüfen
|
||||
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
|
||||
Write-Error "ImportExcel Modul nicht installiert. Bitte: Install-Module -Name ImportExcel"
|
||||
exit
|
||||
}
|
||||
Import-Module ImportExcel
|
||||
|
||||
# Helper für Disk Strings
|
||||
function Get-Disks($diskString) {
|
||||
$result = @{}
|
||||
if ([string]::IsNullOrWhiteSpace($diskString)) { return $result }
|
||||
$sizes = $diskString -split ","
|
||||
for ($i=0; $i -lt $sizes.Count; $i++) {
|
||||
$size = $sizes[$i].Trim()
|
||||
if ($size -match "^\d+$") { $result["scsi$i"] = [int]$size }
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
# Dynamische Sheets
|
||||
$sheetInfo = Get-ExcelSheetInfo -Path $InputFile
|
||||
if ($sheetInfo.Count -lt 2) { Write-Error "Workbook muss mindestens 2 Sheets enthalten."; exit }
|
||||
|
||||
# VM Sheet
|
||||
$vmData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[0].Name
|
||||
$vmList = @()
|
||||
foreach ($row in $vmData) {
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{}
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = $prop.Value
|
||||
}
|
||||
|
||||
# optional: scsi Disks als eigene Keys
|
||||
if ($row.'Disk Size') {
|
||||
$disks = Get-Disks $row.'Disk Size'
|
||||
foreach ($k in $disks.Keys) { $obj[$k] = $disks[$k] }
|
||||
}
|
||||
|
||||
$vmList += $obj
|
||||
}
|
||||
|
||||
# CT Sheet
|
||||
$ctData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[1].Name
|
||||
$ctList = @()
|
||||
foreach ($row in $ctData) {
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{}
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = $prop.Value
|
||||
}
|
||||
|
||||
# optional: scsi Disks als eigene Keys
|
||||
if ($row.'Disk Size') {
|
||||
$disks = Get-Disks $row.'Disk Size'
|
||||
foreach ($k in $disks.Keys) { $obj[$k] = $disks[$k] }
|
||||
}
|
||||
|
||||
$ctList += $obj
|
||||
}
|
||||
|
||||
# Export JSON
|
||||
$vmList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputVM
|
||||
$ctList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputCT
|
||||
|
||||
Write-Host "VM JSON: $OutputVM"
|
||||
Write-Host "CT JSON: $OutputCT"
|
||||
Write-Host "VM Count: $($vmList.Count)"
|
||||
Write-Host "CT Count: $($ctList.Count)"
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
param(
|
||||
[string]$InputFile,
|
||||
[string]$OutputVM = "vm_output.json",
|
||||
[string]$OutputCT = "ct_output.json"
|
||||
)
|
||||
|
||||
# ================================
|
||||
# Pfad Resolution
|
||||
# ================================
|
||||
$basePath = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
|
||||
if (-not $InputFile) { $InputFile = Join-Path $basePath "vm_list.xlsx" }
|
||||
$OutputVM = Join-Path $basePath $OutputVM
|
||||
$OutputCT = Join-Path $basePath $OutputCT
|
||||
|
||||
Write-Host "Using Excel file: $InputFile"
|
||||
|
||||
# ================================
|
||||
# ImportExcel Modul prüfen
|
||||
# ================================
|
||||
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
|
||||
Write-Error "ImportExcel Modul nicht installiert. Bitte: Install-Module -Name ImportExcel"
|
||||
exit
|
||||
}
|
||||
Import-Module ImportExcel
|
||||
|
||||
# ================================
|
||||
# Helper: Disk Strings
|
||||
# ================================
|
||||
function Get-Disks($diskString) {
|
||||
$result = @{}
|
||||
if ([string]::IsNullOrWhiteSpace($diskString)) { return $result }
|
||||
$sizes = $diskString -split ","
|
||||
for ($i=0; $i -lt $sizes.Count; $i++) {
|
||||
$size = $sizes[$i].Trim()
|
||||
if ($size -match "^\d+$") { $result["scsi$i"] = [int]$size }
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Helper: Convert X / "" zu Boolean
|
||||
# ================================
|
||||
function Convert-ToBool($value) {
|
||||
if ($value -eq "X") { return $true }
|
||||
elseif ([string]::IsNullOrWhiteSpace($value)) { return $false }
|
||||
else { return $value } # andere Werte bleiben unverändert
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Dynamische Sheets
|
||||
# ================================
|
||||
$sheetInfo = Get-ExcelSheetInfo -Path $InputFile
|
||||
if ($sheetInfo.Count -lt 2) { Write-Error "Workbook muss mindestens 2 Sheets enthalten."; exit }
|
||||
|
||||
# ================================
|
||||
# VM Sheet einlesen
|
||||
# ================================
|
||||
$vmData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[0].Name
|
||||
$vmList = @()
|
||||
foreach ($row in $vmData) {
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{}
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = Convert-ToBool $prop.Value
|
||||
}
|
||||
|
||||
# optional: scsi Disks
|
||||
if ($row.'Disk Size') {
|
||||
$disks = Get-Disks $row.'Disk Size'
|
||||
foreach ($k in $disks.Keys) { $obj[$k] = $disks[$k] }
|
||||
}
|
||||
|
||||
$vmList += $obj
|
||||
}
|
||||
|
||||
# ================================
|
||||
# CT Sheet einlesen
|
||||
# ================================
|
||||
$ctData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[1].Name
|
||||
$ctList = @()
|
||||
foreach ($row in $ctData) {
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{}
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = Convert-ToBool $prop.Value
|
||||
}
|
||||
|
||||
# optional: scsi Disks
|
||||
if ($row.'Disk Size') {
|
||||
$disks = Get-Disks $row.'Disk Size'
|
||||
foreach ($k in $disks.Keys) { $obj[$k] = $disks[$k] }
|
||||
}
|
||||
|
||||
$ctList += $obj
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Export JSON
|
||||
# ================================
|
||||
$vmList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputVM
|
||||
$ctList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputCT
|
||||
|
||||
Write-Host "VM JSON: $OutputVM"
|
||||
Write-Host "CT JSON: $OutputCT"
|
||||
Write-Host "VM Count: $($vmList.Count)"
|
||||
Write-Host "CT Count: $($ctList.Count)"
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
param(
|
||||
[string]$InputFile,
|
||||
[string]$OutputVM = "vm_output.json",
|
||||
[string]$OutputCT = "ct_output.json"
|
||||
)
|
||||
|
||||
# ================================
|
||||
# Pfad Resolution
|
||||
# ================================
|
||||
$basePath = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
|
||||
if (-not $InputFile) { $InputFile = Join-Path $basePath "vm_list.xlsx" }
|
||||
$OutputVM = Join-Path $basePath $OutputVM
|
||||
$OutputCT = Join-Path $basePath $OutputCT
|
||||
|
||||
Write-Host "Using Excel file: $InputFile"
|
||||
|
||||
# ================================
|
||||
# ImportExcel Modul prüfen
|
||||
# ================================
|
||||
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
|
||||
Write-Error "ImportExcel Modul nicht installiert. Bitte: Install-Module -Name ImportExcel"
|
||||
exit
|
||||
}
|
||||
Import-Module ImportExcel
|
||||
|
||||
# ================================
|
||||
# Helper: Value Converter
|
||||
# ================================
|
||||
function Convert-Value($value) {
|
||||
|
||||
if ($value -eq "X") { return $true }
|
||||
if ([string]::IsNullOrWhiteSpace($value)) { return $false }
|
||||
|
||||
if ($value -is [double]) { return [int]$value }
|
||||
|
||||
if ($value -match "^\d+(\.0)?$") { return [int]$value }
|
||||
|
||||
return $value
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Helper: Disk Mapping
|
||||
# ================================
|
||||
function Get-DisksMapping($deviceInput, $sizeInput) {
|
||||
|
||||
$devices = @()
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($deviceInput) -or [string]::IsNullOrWhiteSpace($sizeInput)) {
|
||||
return @()
|
||||
}
|
||||
|
||||
$deviceRaw = [string]$deviceInput
|
||||
$sizeRaw = [string]$sizeInput
|
||||
|
||||
if ($deviceRaw -match "\." -and $sizeRaw -match "\.") {
|
||||
$deviceList = $deviceRaw -split "\."
|
||||
$sizeList = $sizeRaw -split "\."
|
||||
}
|
||||
elseif ($deviceRaw -match "," -or $sizeRaw -match ",") {
|
||||
$deviceList = $deviceRaw -split ","
|
||||
$sizeList = $sizeRaw -split ","
|
||||
}
|
||||
else {
|
||||
if ($deviceRaw -match "^\d+$" -and $sizeRaw -match "^\d+$") {
|
||||
return @(
|
||||
[PSCustomObject]@{
|
||||
Device = [int]$deviceRaw
|
||||
Size = [int]$sizeRaw
|
||||
}
|
||||
)
|
||||
}
|
||||
return @()
|
||||
}
|
||||
|
||||
for ($i = 0; $i -lt $deviceList.Count; $i++) {
|
||||
|
||||
$dev = $deviceList[$i].Trim()
|
||||
$size = if ($i -lt $sizeList.Count) { $sizeList[$i].Trim() } else { 0 }
|
||||
|
||||
if ($dev -match "^\d+$") {
|
||||
$devices += [PSCustomObject]@{
|
||||
Device = [int]$dev
|
||||
Size = [int]$size
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return @($devices)
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Sheets
|
||||
# ================================
|
||||
$sheetInfo = Get-ExcelSheetInfo -Path $InputFile
|
||||
if ($sheetInfo.Count -lt 2) {
|
||||
Write-Error "Workbook muss mindestens 2 Sheets enthalten."
|
||||
exit
|
||||
}
|
||||
|
||||
# ================================
|
||||
# VM Sheet
|
||||
# ================================
|
||||
$vmData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[0].Name
|
||||
$vmList = @()
|
||||
|
||||
foreach ($row in $vmData) {
|
||||
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{ }
|
||||
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = Convert-Value $prop.Value
|
||||
}
|
||||
|
||||
# Disks
|
||||
$obj['Disks'] = @(Get-DisksMapping $row.'Device' $row.'Disk Size')
|
||||
|
||||
# Alte Felder entfernen
|
||||
$obj.Remove('Device')
|
||||
$obj.Remove('Disk Size')
|
||||
|
||||
$vmList += $obj
|
||||
}
|
||||
|
||||
# ================================
|
||||
# CT Sheet
|
||||
# ================================
|
||||
$ctData = Import-Excel -Path $InputFile -WorksheetName $sheetInfo[1].Name
|
||||
$ctList = @()
|
||||
|
||||
foreach ($row in $ctData) {
|
||||
|
||||
if (-not $row.Node) { continue }
|
||||
|
||||
$obj = @{ }
|
||||
|
||||
foreach ($prop in $row.PSObject.Properties) {
|
||||
$obj[$prop.Name] = Convert-Value $prop.Value
|
||||
}
|
||||
|
||||
# Disks
|
||||
$obj['Disks'] = @(Get-DisksMapping $row.'Device' $row.'Disk Size')
|
||||
|
||||
# Alte Felder entfernen
|
||||
$obj.Remove('Device')
|
||||
$obj.Remove('Disk Size')
|
||||
|
||||
$ctList += $obj
|
||||
}
|
||||
|
||||
# ================================
|
||||
# Export JSON
|
||||
# ================================
|
||||
$vmList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputVM
|
||||
$ctList | ConvertTo-Json -Depth 5 | Out-File -Encoding UTF8 $OutputCT
|
||||
|
||||
Write-Host "VM JSON: $OutputVM"
|
||||
Write-Host "CT JSON: $OutputCT"
|
||||
Write-Host "VM Count: $($vmList.Count)"
|
||||
Write-Host "CT Count: $($ctList.Count)"
|
||||
Executable
BIN
Binary file not shown.
Executable
+102
@@ -0,0 +1,102 @@
|
||||
[
|
||||
{
|
||||
"Gateway": "9.99.20.254",
|
||||
"Node": "fhs0",
|
||||
"BIOS": "OVMF (UEFI)",
|
||||
"Backup": false,
|
||||
"TPM Version": "v2.0",
|
||||
"Maschine": "q35",
|
||||
"Ballooning": true,
|
||||
"Bus": "SCSI",
|
||||
"Bridge": "DMZ",
|
||||
"KSM": true,
|
||||
"NTP Server": "9.99.20.254",
|
||||
"Disks": [
|
||||
{
|
||||
"Device": 0,
|
||||
"Size": 20
|
||||
},
|
||||
{
|
||||
"Device": 1,
|
||||
"Size": 5
|
||||
}
|
||||
],
|
||||
"Service": "Certificate",
|
||||
"VLAN Tag": false,
|
||||
"Hostname": "subca",
|
||||
"VirtIO Storage": "CEPH-Share Front",
|
||||
"Domain Name": "cert.heim.lan",
|
||||
"USE ISO": true,
|
||||
"Add TPM": true,
|
||||
"Model": "VirtIO (paravirtualized)",
|
||||
"OS Typ": "Microsoft",
|
||||
"Cores": 2,
|
||||
"Disk Storage": "CEPH_SSD FRONT",
|
||||
"Memory": 1024,
|
||||
"Enable VirtIO": true,
|
||||
"Firewall": false,
|
||||
"EFI STORAGE": "CEPH_SSD FRONT",
|
||||
"VirtIO ISO": "virtio-win-0.1.285.iso",
|
||||
"OS Version": "11/2022/2025",
|
||||
"IPv4": "9.99.20.1",
|
||||
"Netmask": "255.255.255.0",
|
||||
"Name": "CA_HEIM",
|
||||
"Add EFI DISK": true,
|
||||
"ISO Storage": "ISO ALL",
|
||||
"ISO File": "de-de_windows_server_2025_updated_dec_2025_x64_dvd_c54ab58b.iso",
|
||||
"Sockets": 1,
|
||||
"DNS Server": "9.99.20.254",
|
||||
"Start at boot": false,
|
||||
"Qemu Agent": true,
|
||||
"VM ID": 250,
|
||||
"TPM Storage": "CEPH_SSD FRONT"
|
||||
},
|
||||
{
|
||||
"Gateway": "9.99.70.254",
|
||||
"Node": "fhs1",
|
||||
"BIOS": "Default (SeaBIOS)",
|
||||
"Backup": false,
|
||||
"TPM Version": false,
|
||||
"Maschine": "i440fx",
|
||||
"Ballooning": false,
|
||||
"Bus": "SCSI",
|
||||
"Bridge": "PROXY",
|
||||
"KSM": false,
|
||||
"NTP Server": "9.99.70.254",
|
||||
"Disks": [
|
||||
{
|
||||
"Device": 0,
|
||||
"Size": 20
|
||||
}
|
||||
],
|
||||
"Service": "IDM",
|
||||
"VLAN Tag": false,
|
||||
"Hostname": "idm",
|
||||
"VirtIO Storage": false,
|
||||
"Domain Name": "proxy.heim.lan",
|
||||
"USE ISO": true,
|
||||
"Add TPM": false,
|
||||
"Model": "VirtIO (paravirtualized)",
|
||||
"OS Typ": "Linux",
|
||||
"Cores": 2,
|
||||
"Disk Storage": "CEPH_SSD FRONT",
|
||||
"Memory": 1024,
|
||||
"Enable VirtIO": false,
|
||||
"Firewall": false,
|
||||
"EFI STORAGE": false,
|
||||
"VirtIO ISO": false,
|
||||
"OS Version": "6.x - 2.6 Kernel",
|
||||
"IPv4": "9.99.70.22",
|
||||
"Netmask": "255.255.255.0",
|
||||
"Name": "keycloak",
|
||||
"Add EFI DISK": false,
|
||||
"ISO Storage": "ISO ALL",
|
||||
"ISO File": "debian-13.2.0-amd64-DVD-1.iso",
|
||||
"Sockets": 1,
|
||||
"DNS Server": "9.99.70.254",
|
||||
"Start at boot": false,
|
||||
"Qemu Agent": true,
|
||||
"VM ID": 251,
|
||||
"TPM Storage": false
|
||||
}
|
||||
]
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user