script mkvm mise a jour
This commit is contained in:
parent
35e816c2eb
commit
80295cba99
16
scripts/mkvm
16
scripts/mkvm
@ -17,6 +17,11 @@ vmMem[s-nas]=512
|
|||||||
vmMem[s-infra]=768
|
vmMem[s-infra]=768
|
||||||
vmMem[s-backup]=768
|
vmMem[s-backup]=768
|
||||||
vmMem[s-elk]=3072
|
vmMem[s-elk]=3072
|
||||||
|
vmMem[s-awx]=4096
|
||||||
|
|
||||||
|
declare -A vmCpus
|
||||||
|
vmCpus[s-peertube]=2
|
||||||
|
vmCpus[s-awx]=2
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "$0 - version ${mkvmrelease} - Ova version ${ovarelease}"
|
echo "$0 - version ${mkvmrelease} - Ova version ${ovarelease}"
|
||||||
@ -40,12 +45,15 @@ create_vm () {
|
|||||||
if [[ "${deletemode}" = 1 ]] ; then
|
if [[ "${deletemode}" = 1 ]] ; then
|
||||||
VBoxManage unregistervm --delete "${nom}"
|
VBoxManage unregistervm --delete "${nom}"
|
||||||
fi
|
fi
|
||||||
vboxmanage import "${nomova}" --vsys 0 --vmname "${nom}"
|
mem=1024
|
||||||
|
cpus=1
|
||||||
if [[ -v vmMem[${nom}] ]]; then
|
if [[ -v vmMem[${nom}] ]]; then
|
||||||
mem=${vmMem[${nom}]}
|
mem=${vmMem[${nom}]}
|
||||||
echo "machine ${nom}: ${mem} ..."
|
|
||||||
VBoxManage modifyvm "${nom}" --memory "${mem}"
|
|
||||||
fi
|
fi
|
||||||
|
if [[ -v vmCpus[${nom}] ]]; then
|
||||||
|
cpus=${vmCpus[${nom}]}
|
||||||
|
fi
|
||||||
|
vboxmanage import "${nomova}" --vsys 0 --vmname "${nom}" --memory "${mem}" --cpus "${cpus}"
|
||||||
}
|
}
|
||||||
|
|
||||||
setif () {
|
setif () {
|
||||||
@ -145,6 +153,8 @@ elif [[ "${vm}" == "r-vp2" ]] ; then
|
|||||||
./addint.r-vp2
|
./addint.r-vp2
|
||||||
elif [[ "${vm}" == "s-agence" ]] ; then
|
elif [[ "${vm}" == "s-agence" ]] ; then
|
||||||
create_if "${vm}" "n-adm" "n-agence"
|
create_if "${vm}" "n-adm" "n-agence"
|
||||||
|
elif [[ "${vm}" == "s-awx" ]] ; then
|
||||||
|
create_if "${vm}" "n-adm" "n-infra"
|
||||||
else
|
else
|
||||||
echo "$0 : vm ${vm} non prevue "
|
echo "$0 : vm ${vm} non prevue "
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -20,12 +20,16 @@ $vmMem = @{
|
|||||||
"s-elk" = "3072"
|
"s-elk" = "3072"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$vmCpus = @{
|
||||||
|
"s-awx" = "4096"
|
||||||
|
"s-peertube" = "4096"
|
||||||
|
}
|
||||||
#FONCTIONS
|
#FONCTIONS
|
||||||
|
|
||||||
function create_vm{ param([string]$nomvm)
|
function create_vm{ param([string]$nomvm)
|
||||||
|
|
||||||
if ($vmMem.ContainsKey($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"
|
Write-Host "Machine $nomvm importée"
|
||||||
} else {
|
} else {
|
||||||
#Importation depuis l'ova
|
#Importation depuis l'ova
|
||||||
@ -133,6 +137,22 @@ elseif ($args[0] -eq "s-kea2") {
|
|||||||
create_if $args[0] "int" 3 "n-user"
|
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") {
|
elseif ($args[0] -eq "s-agence") {
|
||||||
|
|
||||||
create_vm $args[0]
|
create_vm $args[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user