From 4dd5b711e2b2261ab062cef954db986e1b9af458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAlbert?= Date: Fri, 20 Jan 2023 09:15:54 +0100 Subject: [PATCH] nettoyage --- roles/{s-lb-bd-ab => lb-bd}/files/.my.cnf | 0 .../{s-lb-bd => lb-bd}/files/installmysql.sh | 0 roles/{s-lb-bd-ab => lb-bd}/files/my.cnf | 0 roles/{s-lb-bd-ab => lb-bd}/handlers/main.yml | 0 roles/{s-lb-bd => lb-bd}/tasks/main.yml | 0 roles/{s-lb => lb-front}/files/goss.yaml | 0 roles/{s-lb => lb-front}/files/haproxy.cfg | 0 roles/{s-lb-ab => lb-front}/handlers/main.yml | 0 roles/{s-lb => lb-front}/tasks/main.yml | 0 .../{s-nas-client => lb-nfs-client}/README.md | 0 .../handlers/main.yml | 0 .../tasks/main.yml | 0 .../{s-nas-server => lb-nfs-server}/README.md | 0 .../files/exports | 0 .../handlers/main.yml | 0 .../tasks/main.yml | 0 roles/{s-lb-wordpress => lb-web}/README.md | 0 .../defaults/main.yml | 0 .../files/wp-config.php | 0 .../handlers/main.yml | 0 .../{s-lb-wordpress => lb-web}/tasks/main.yml | 0 roles/{ => old}/s-lb-ab/README.md | 0 roles/{ => old}/s-lb-ab/files/actu.sh | 0 roles/{ => old}/s-lb-ab/files/haproxy.cfg | 0 roles/{s-lb => old/s-lb-ab}/handlers/main.yml | 0 roles/{ => old}/s-lb-ab/tasks/main.yml | 0 roles/{ => old}/s-lb-bd-ab/README.txt | 0 .../{s-lb-bd => old/s-lb-bd-ab}/files/.my.cnf | 0 .../s-lb-bd-ab/files/installmysql.sh | 0 .../{s-lb-bd => old/s-lb-bd-ab}/files/my.cnf | 0 .../s-lb-bd-ab}/handlers/main.yml | 0 roles/{ => old}/s-lb-web-ab/files/.my.cnf | 0 .../{ => old}/s-lb-web-ab/files/compter.bash | 0 roles/{ => old}/s-lb-web-ab/handlers/main.yml | 0 roles/{ => old}/s-lb-web-ab/tasks/main.yml | 0 roles/{ => old}/s-lb-web/README.md | 0 roles/{ => old}/s-lb-web/files/.my.cnf | 0 roles/{ => old}/s-lb-web/files/compter.bash | 0 roles/{ => old}/s-lb-web/handlers/main.yml | 0 roles/{ => old}/s-lb-web/tasks/main.yml | 0 s-lb-web3.yml | 11 -- s-lb-wordpress3.yml | 18 --- scripts/mkvm.pl | 135 ++++++++++++++++++ 43 files changed, 135 insertions(+), 29 deletions(-) rename roles/{s-lb-bd-ab => lb-bd}/files/.my.cnf (100%) rename roles/{s-lb-bd => lb-bd}/files/installmysql.sh (100%) rename roles/{s-lb-bd-ab => lb-bd}/files/my.cnf (100%) rename roles/{s-lb-bd-ab => lb-bd}/handlers/main.yml (100%) rename roles/{s-lb-bd => lb-bd}/tasks/main.yml (100%) rename roles/{s-lb => lb-front}/files/goss.yaml (100%) rename roles/{s-lb => lb-front}/files/haproxy.cfg (100%) rename roles/{s-lb-ab => lb-front}/handlers/main.yml (100%) rename roles/{s-lb => lb-front}/tasks/main.yml (100%) rename roles/{s-nas-client => lb-nfs-client}/README.md (100%) rename roles/{s-nas-client => lb-nfs-client}/handlers/main.yml (100%) rename roles/{s-nas-client => lb-nfs-client}/tasks/main.yml (100%) rename roles/{s-nas-server => lb-nfs-server}/README.md (100%) rename roles/{s-nas-server => lb-nfs-server}/files/exports (100%) rename roles/{s-nas-server => lb-nfs-server}/handlers/main.yml (100%) rename roles/{s-nas-server => lb-nfs-server}/tasks/main.yml (100%) rename roles/{s-lb-wordpress => lb-web}/README.md (100%) rename roles/{s-lb-wordpress => lb-web}/defaults/main.yml (100%) rename roles/{s-lb-wordpress => lb-web}/files/wp-config.php (100%) rename roles/{s-lb-wordpress => lb-web}/handlers/main.yml (100%) rename roles/{s-lb-wordpress => lb-web}/tasks/main.yml (100%) rename roles/{ => old}/s-lb-ab/README.md (100%) rename roles/{ => old}/s-lb-ab/files/actu.sh (100%) rename roles/{ => old}/s-lb-ab/files/haproxy.cfg (100%) rename roles/{s-lb => old/s-lb-ab}/handlers/main.yml (100%) rename roles/{ => old}/s-lb-ab/tasks/main.yml (100%) rename roles/{ => old}/s-lb-bd-ab/README.txt (100%) rename roles/{s-lb-bd => old/s-lb-bd-ab}/files/.my.cnf (100%) rename roles/{ => old}/s-lb-bd-ab/files/installmysql.sh (100%) rename roles/{s-lb-bd => old/s-lb-bd-ab}/files/my.cnf (100%) rename roles/{s-lb-bd => old/s-lb-bd-ab}/handlers/main.yml (100%) rename roles/{ => old}/s-lb-web-ab/files/.my.cnf (100%) rename roles/{ => old}/s-lb-web-ab/files/compter.bash (100%) rename roles/{ => old}/s-lb-web-ab/handlers/main.yml (100%) rename roles/{ => old}/s-lb-web-ab/tasks/main.yml (100%) rename roles/{ => old}/s-lb-web/README.md (100%) rename roles/{ => old}/s-lb-web/files/.my.cnf (100%) rename roles/{ => old}/s-lb-web/files/compter.bash (100%) rename roles/{ => old}/s-lb-web/handlers/main.yml (100%) rename roles/{ => old}/s-lb-web/tasks/main.yml (100%) delete mode 100644 s-lb-web3.yml delete mode 100644 s-lb-wordpress3.yml create mode 100755 scripts/mkvm.pl diff --git a/roles/s-lb-bd-ab/files/.my.cnf b/roles/lb-bd/files/.my.cnf similarity index 100% rename from roles/s-lb-bd-ab/files/.my.cnf rename to roles/lb-bd/files/.my.cnf diff --git a/roles/s-lb-bd/files/installmysql.sh b/roles/lb-bd/files/installmysql.sh similarity index 100% rename from roles/s-lb-bd/files/installmysql.sh rename to roles/lb-bd/files/installmysql.sh diff --git a/roles/s-lb-bd-ab/files/my.cnf b/roles/lb-bd/files/my.cnf similarity index 100% rename from roles/s-lb-bd-ab/files/my.cnf rename to roles/lb-bd/files/my.cnf diff --git a/roles/s-lb-bd-ab/handlers/main.yml b/roles/lb-bd/handlers/main.yml similarity index 100% rename from roles/s-lb-bd-ab/handlers/main.yml rename to roles/lb-bd/handlers/main.yml diff --git a/roles/s-lb-bd/tasks/main.yml b/roles/lb-bd/tasks/main.yml similarity index 100% rename from roles/s-lb-bd/tasks/main.yml rename to roles/lb-bd/tasks/main.yml diff --git a/roles/s-lb/files/goss.yaml b/roles/lb-front/files/goss.yaml similarity index 100% rename from roles/s-lb/files/goss.yaml rename to roles/lb-front/files/goss.yaml diff --git a/roles/s-lb/files/haproxy.cfg b/roles/lb-front/files/haproxy.cfg similarity index 100% rename from roles/s-lb/files/haproxy.cfg rename to roles/lb-front/files/haproxy.cfg diff --git a/roles/s-lb-ab/handlers/main.yml b/roles/lb-front/handlers/main.yml similarity index 100% rename from roles/s-lb-ab/handlers/main.yml rename to roles/lb-front/handlers/main.yml diff --git a/roles/s-lb/tasks/main.yml b/roles/lb-front/tasks/main.yml similarity index 100% rename from roles/s-lb/tasks/main.yml rename to roles/lb-front/tasks/main.yml diff --git a/roles/s-nas-client/README.md b/roles/lb-nfs-client/README.md similarity index 100% rename from roles/s-nas-client/README.md rename to roles/lb-nfs-client/README.md diff --git a/roles/s-nas-client/handlers/main.yml b/roles/lb-nfs-client/handlers/main.yml similarity index 100% rename from roles/s-nas-client/handlers/main.yml rename to roles/lb-nfs-client/handlers/main.yml diff --git a/roles/s-nas-client/tasks/main.yml b/roles/lb-nfs-client/tasks/main.yml similarity index 100% rename from roles/s-nas-client/tasks/main.yml rename to roles/lb-nfs-client/tasks/main.yml diff --git a/roles/s-nas-server/README.md b/roles/lb-nfs-server/README.md similarity index 100% rename from roles/s-nas-server/README.md rename to roles/lb-nfs-server/README.md diff --git a/roles/s-nas-server/files/exports b/roles/lb-nfs-server/files/exports similarity index 100% rename from roles/s-nas-server/files/exports rename to roles/lb-nfs-server/files/exports diff --git a/roles/s-nas-server/handlers/main.yml b/roles/lb-nfs-server/handlers/main.yml similarity index 100% rename from roles/s-nas-server/handlers/main.yml rename to roles/lb-nfs-server/handlers/main.yml diff --git a/roles/s-nas-server/tasks/main.yml b/roles/lb-nfs-server/tasks/main.yml similarity index 100% rename from roles/s-nas-server/tasks/main.yml rename to roles/lb-nfs-server/tasks/main.yml diff --git a/roles/s-lb-wordpress/README.md b/roles/lb-web/README.md similarity index 100% rename from roles/s-lb-wordpress/README.md rename to roles/lb-web/README.md diff --git a/roles/s-lb-wordpress/defaults/main.yml b/roles/lb-web/defaults/main.yml similarity index 100% rename from roles/s-lb-wordpress/defaults/main.yml rename to roles/lb-web/defaults/main.yml diff --git a/roles/s-lb-wordpress/files/wp-config.php b/roles/lb-web/files/wp-config.php similarity index 100% rename from roles/s-lb-wordpress/files/wp-config.php rename to roles/lb-web/files/wp-config.php diff --git a/roles/s-lb-wordpress/handlers/main.yml b/roles/lb-web/handlers/main.yml similarity index 100% rename from roles/s-lb-wordpress/handlers/main.yml rename to roles/lb-web/handlers/main.yml diff --git a/roles/s-lb-wordpress/tasks/main.yml b/roles/lb-web/tasks/main.yml similarity index 100% rename from roles/s-lb-wordpress/tasks/main.yml rename to roles/lb-web/tasks/main.yml diff --git a/roles/s-lb-ab/README.md b/roles/old/s-lb-ab/README.md similarity index 100% rename from roles/s-lb-ab/README.md rename to roles/old/s-lb-ab/README.md diff --git a/roles/s-lb-ab/files/actu.sh b/roles/old/s-lb-ab/files/actu.sh similarity index 100% rename from roles/s-lb-ab/files/actu.sh rename to roles/old/s-lb-ab/files/actu.sh diff --git a/roles/s-lb-ab/files/haproxy.cfg b/roles/old/s-lb-ab/files/haproxy.cfg similarity index 100% rename from roles/s-lb-ab/files/haproxy.cfg rename to roles/old/s-lb-ab/files/haproxy.cfg diff --git a/roles/s-lb/handlers/main.yml b/roles/old/s-lb-ab/handlers/main.yml similarity index 100% rename from roles/s-lb/handlers/main.yml rename to roles/old/s-lb-ab/handlers/main.yml diff --git a/roles/s-lb-ab/tasks/main.yml b/roles/old/s-lb-ab/tasks/main.yml similarity index 100% rename from roles/s-lb-ab/tasks/main.yml rename to roles/old/s-lb-ab/tasks/main.yml diff --git a/roles/s-lb-bd-ab/README.txt b/roles/old/s-lb-bd-ab/README.txt similarity index 100% rename from roles/s-lb-bd-ab/README.txt rename to roles/old/s-lb-bd-ab/README.txt diff --git a/roles/s-lb-bd/files/.my.cnf b/roles/old/s-lb-bd-ab/files/.my.cnf similarity index 100% rename from roles/s-lb-bd/files/.my.cnf rename to roles/old/s-lb-bd-ab/files/.my.cnf diff --git a/roles/s-lb-bd-ab/files/installmysql.sh b/roles/old/s-lb-bd-ab/files/installmysql.sh similarity index 100% rename from roles/s-lb-bd-ab/files/installmysql.sh rename to roles/old/s-lb-bd-ab/files/installmysql.sh diff --git a/roles/s-lb-bd/files/my.cnf b/roles/old/s-lb-bd-ab/files/my.cnf similarity index 100% rename from roles/s-lb-bd/files/my.cnf rename to roles/old/s-lb-bd-ab/files/my.cnf diff --git a/roles/s-lb-bd/handlers/main.yml b/roles/old/s-lb-bd-ab/handlers/main.yml similarity index 100% rename from roles/s-lb-bd/handlers/main.yml rename to roles/old/s-lb-bd-ab/handlers/main.yml diff --git a/roles/s-lb-web-ab/files/.my.cnf b/roles/old/s-lb-web-ab/files/.my.cnf similarity index 100% rename from roles/s-lb-web-ab/files/.my.cnf rename to roles/old/s-lb-web-ab/files/.my.cnf diff --git a/roles/s-lb-web-ab/files/compter.bash b/roles/old/s-lb-web-ab/files/compter.bash similarity index 100% rename from roles/s-lb-web-ab/files/compter.bash rename to roles/old/s-lb-web-ab/files/compter.bash diff --git a/roles/s-lb-web-ab/handlers/main.yml b/roles/old/s-lb-web-ab/handlers/main.yml similarity index 100% rename from roles/s-lb-web-ab/handlers/main.yml rename to roles/old/s-lb-web-ab/handlers/main.yml diff --git a/roles/s-lb-web-ab/tasks/main.yml b/roles/old/s-lb-web-ab/tasks/main.yml similarity index 100% rename from roles/s-lb-web-ab/tasks/main.yml rename to roles/old/s-lb-web-ab/tasks/main.yml diff --git a/roles/s-lb-web/README.md b/roles/old/s-lb-web/README.md similarity index 100% rename from roles/s-lb-web/README.md rename to roles/old/s-lb-web/README.md diff --git a/roles/s-lb-web/files/.my.cnf b/roles/old/s-lb-web/files/.my.cnf similarity index 100% rename from roles/s-lb-web/files/.my.cnf rename to roles/old/s-lb-web/files/.my.cnf diff --git a/roles/s-lb-web/files/compter.bash b/roles/old/s-lb-web/files/compter.bash similarity index 100% rename from roles/s-lb-web/files/compter.bash rename to roles/old/s-lb-web/files/compter.bash diff --git a/roles/s-lb-web/handlers/main.yml b/roles/old/s-lb-web/handlers/main.yml similarity index 100% rename from roles/s-lb-web/handlers/main.yml rename to roles/old/s-lb-web/handlers/main.yml diff --git a/roles/s-lb-web/tasks/main.yml b/roles/old/s-lb-web/tasks/main.yml similarity index 100% rename from roles/s-lb-web/tasks/main.yml rename to roles/old/s-lb-web/tasks/main.yml diff --git a/s-lb-web3.yml b/s-lb-web3.yml deleted file mode 100644 index 0c1dc9b..0000000 --- a/s-lb-web3.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- hosts: localhost - connection: local - - roles: - - base - - s-lb-web-ab - - snmp-agent - - s-nas-client - - post - diff --git a/s-lb-wordpress3.yml b/s-lb-wordpress3.yml deleted file mode 100644 index ed195a5..0000000 --- a/s-lb-wordpress3.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- - - hosts: localhost - connection: local - vars: - wp_mysql_db: "wordpress" - wp_mysql_user: "wp" - wp_mysql_password: "wp" - wp_mysql_host: "192.168.102.50" - - roles: - - base - - goss - - apache2 - - s-lb-wordpress - - snmp-agent - - post - - mysql - - php-fpm diff --git a/scripts/mkvm.pl b/scripts/mkvm.pl new file mode 100755 index 0000000..093a06d --- /dev/null +++ b/scripts/mkvm.pl @@ -0,0 +1,135 @@ +#!/usr/pbin/perl +use strict; +use warnings; +use v5.10; + +my $ovarelease = "2023a"; +my $ovafogrelease = "2023a"; +my $home=$ENV{'HOME'}; +my $ovafile="$home/Téléchargements/debian-bullseye-gsb-".$ovarelease.".ova"; +my $ovafilefog="$home/Téléchargements/debian-buster-gsb-i".$ovafogrelease.".ova"; + +my %vmtab = ( + #name => "s-adm", params => ":1024:" + name => "s-adm", params => ":1024:n-adm:n-infra", + name => "s-infra", params => ":1024:n-adm:n-infra", + name => "s-proxy", params => ":1024:n-adm:n-infra", + name => "r-int", params => ":1024:n-adm:n-link:n-wifi:n-user:n-infra", + name => "r-ext", params => ":1024:n-adm:n-dmz:eno1:n-linkvi:n-link", + name => "s-mon", params => ":1024:n-adm:n-infra", + name => "s-itil", params => ":1024:n-adm:n-infra", + name => "s-appli", params => ":1024:n-adm:n-infra", + name => "s-backup", params => ":1024:n-adm:n-infra", + name => "s-fog", params => ":1024:n-adm:n-infra:n-user", + name => "s-nxc", params => ":1024:n-adm:n-infra", + +) + +sub usage () { + say "$0 - version ${ovarelease}"; + say "$0 : creation VM et parametrage interfaces"; + say "usage : $0 "; + exit 1 ; +} + +sub create_vm () { + my $nom = shift ; + my $nomova = shift ; + if ( $nom == "s-fog" ) { + $nomova = $ovafilefog; + } + if ( ! -r $nomova ) { + say "$0 : erreur ouverture fichier $nomova ..." + exit 3 + } + qx (vboxmanage import $nomova --vsys 0 --vmname $nom); +} + +sub setif () { + my ($vm, $interf, $parm) = @ARGV; + qx(VBoxManage modifyvm $vm --nic"${2}" intnet); + qx(VBoxManage modifyvm $vm --intnet"${2}" "$3"); + qx(VBoxManage modifyvm $vm --nictype"${2}" 82540EM); + qx(VBoxManage modifyvm $vm --cableconnected"${2}" on); + qx(VBoxManage modifyvm $vm --nicpromisc"${2}" allow-all); +} + +sub create_if () { +# enp0s3 + setif "$1" 1 "$2" + setif "$1" 2 "$3" +#(enp0s8) +} + + +create_vm "${vm}" +if [[ "${vm}" == "s-infra" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-proxy" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "r-int" ]] ; then +# n-adm, n-link, n-wifi, n-user, n-infra + create_if "${vm}" "n-adm" "n-infra" + setif "${vm}" 2 "n-link" + setif "${vm}" 3 "n-wifi" + setif "${vm}" 4 "n-user" + setif "${vm}" 5 "n-infra" +elif [[ "${vm}" == "r-ext" ]] ; then + ./addint.r-ext +elif [[ "${vm}" == "s-mon" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-appli" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-backup" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-itil" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-nxc" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-fog" ]] ; then + create_if "${vm}" "n-adm" "n-infra" + setif "${vm}" 3 "n-user" +elif [[ "${vm}" == "s-DNS-ext" ]] ; then + create_if "${vm}" "n-adm" "n-dmz" +elif [[ "${vm}" == "s-web-ext" ]] ; then + create_if "${vm}" "n-adm" "n-dmz" +elif [[ "${vm}" == "s-nxc" ]] ; then + create_if "${vm}" "n-adm" "n-infra" +elif [[ "${vm}" == "s-lb" ]] ; then + create_if "${vm}" "n-adm" "n-dmz" "n-dmz-lb" +elif [[ "${vm}" == "s-web1" ]] ; then + create_if "${vm}" "n-adm" "n-dmz-lb" "n-dmz-db" +# setif "${vm}" 3 "n-dmz-lb" +elif [[ "${vm}" == "s-web2" ]] ; then + create_if "${vm}" "n-adm" "n-dmz-lb" "n-dmz-db" +elif [[ "${vm}" == "s-web3" ]] ; then + create_if "${vm}" "n-adm" "n-dmz-lb" "n-dmz-db" + # setif "${vm}" 3 "n-dmz-lb" +elif [[ "${vm}" == "s-lb-bd" ]] ; then + create_if "${vm}" "n-adm" "n-dmz-db" +elif [[ "${vm}" == "s-nas" ]] ; then + create_if "${vm}" "n-adm" "n-dmz-db" +elif [[ "${vm}" == "r-vp1" ]] ; then + ./addint.r-vp1 +elif [[ "${vm}" == "r-vp2" ]] ; then + ./addint.r-vp2 +elif [[ "${vm}" == "s-agence" ]] ; then + create_if "${vm}" "n-adm" "n-agence" + +else + echo "$0 : vm ${vm} non prevu" + exit 2 +fi + + +sub usage () { + print "usage : mkvm.pl \n"; + print "cree une VM a partir d'un fichier OVA et parametre les interfaces"; + exit 1 ; +} + +sub main () { + my $vm = shift; + usage unless ( $vm); + +}