From 80295cba99b2fcf00e854009e9b4f99dd56c372d Mon Sep 17 00:00:00 2001 From: Alhassane Kone Date: Fri, 2 Feb 2024 15:00:22 +0100 Subject: [PATCH] script mkvm mise a jour --- scripts/mkvm | 16 +++++++++++++--- scripts/mkvm.ps1 | 22 +++++++++++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/scripts/mkvm b/scripts/mkvm index 0ee6e7e..e4ce2a9 100755 --- a/scripts/mkvm +++ b/scripts/mkvm @@ -17,6 +17,11 @@ vmMem[s-nas]=512 vmMem[s-infra]=768 vmMem[s-backup]=768 vmMem[s-elk]=3072 +vmMem[s-awx]=4096 + +declare -A vmCpus +vmCpus[s-peertube]=2 +vmCpus[s-awx]=2 usage () { echo "$0 - version ${mkvmrelease} - Ova version ${ovarelease}" @@ -40,12 +45,15 @@ create_vm () { if [[ "${deletemode}" = 1 ]] ; then VBoxManage unregistervm --delete "${nom}" fi - vboxmanage import "${nomova}" --vsys 0 --vmname "${nom}" + mem=1024 + cpus=1 if [[ -v vmMem[${nom}] ]]; then mem=${vmMem[${nom}]} - echo "machine ${nom}: ${mem} ..." - VBoxManage modifyvm "${nom}" --memory "${mem}" fi + if [[ -v vmCpus[${nom}] ]]; then + cpus=${vmCpus[${nom}]} + fi + vboxmanage import "${nomova}" --vsys 0 --vmname "${nom}" --memory "${mem}" --cpus "${cpus}" } setif () { @@ -145,6 +153,8 @@ elif [[ "${vm}" == "r-vp2" ]] ; then ./addint.r-vp2 elif [[ "${vm}" == "s-agence" ]] ; then create_if "${vm}" "n-adm" "n-agence" +elif [[ "${vm}" == "s-awx" ]] ; then + create_if "${vm}" "n-adm" "n-infra" else echo "$0 : vm ${vm} non prevue " exit 2 diff --git a/scripts/mkvm.ps1 b/scripts/mkvm.ps1 index 01dd6dc..755f0a1 100644 --- a/scripts/mkvm.ps1 +++ b/scripts/mkvm.ps1 @@ -20,12 +20,16 @@ $vmMem = @{ "s-elk" = "3072" } +$vmCpus = @{ + "s-awx" = "4096" + "s-peertube" = "4096" +} #FONCTIONS function create_vm{ param([string]$nomvm) if ($vmMem.ContainsKey($nomvm)) { - & "$vboxmanage" import "$ovafile" --vsys 0 --vmname "$nomvm" --memory $vmMem[$nomvm] + & "$vboxmanage" import "$ovafile" --vsys 0 --vmname "$nomvm" --memory $vmMem[$nomvm] --cpus $vmCpus[$nomvm} Write-Host "Machine $nomvm importée" } else { #Importation depuis l'ova @@ -133,6 +137,22 @@ elseif ($args[0] -eq "s-kea2") { create_if $args[0] "int" 3 "n-user" } + +elseif ($args[0] -eq "s-awx") { + + create_vm $args[0] + create_if $args[0] "int" 1 "n-adm" + create_if $args[0] "int" 2 "n-infra" +} + + +elseif ($args[0] -eq "s-peertube") { + + create_vm $args[0] + create_if $args[0] "int" 1 "n-adm" + create_if $args[0] "int" 2 "n-infra" +} + elseif ($args[0] -eq "s-agence") { create_vm $args[0]