Projet

Général

Profil

Installation Gateway dans nebula » Historique » Version 85

Gilles Grandgérard, 21/04/2015 16:56

1 47 Gilles Grandgérard
{{toc}}
2 47 Gilles Grandgérard
3 61 Klaas TJEBBES
http://dev-eole.ac-dijon.fr/projects/eole-ci-tests/wiki/ModeleReseaux
4 61 Klaas TJEBBES
5 50 Gilles Grandgérard
h1. A) Installation pour utilisation d'une gateway
6 3 Gilles Grandgérard
7 40 Gilles Grandgérard
h2. A.1) Récupération du dépot eole-ci-test
8 1 Gilles Grandgérard
9 4 Gilles Grandgérard
Faire :
10 4 Gilles Grandgérard
<pre>
11 29 Gérald Schwartzmann
git clone https://dev-eole.ac-dijon.fr/git/eole-ci-tests.git
12 4 Gilles Grandgérard
</pre>
13 1 Gilles Grandgérard
14 40 Gilles Grandgérard
h2. A.2) Ajout de la gateway dans le eole-ci-tests
15 1 Gilles Grandgérard
16 77 Gilles Grandgérard
Attention: 
17 77 Gilles Grandgérard
- Le <user_nebula> n'est pas obligatoirement le même sur ONE et sur BOGDANOV. Vous aurez peut être à créer un ou deux fichiers !
18 77 Gilles Grandgérard
- Si vous prévoyez d'utiliser les 2 environnements en même temps, utilisez deux IP !
19 77 Gilles Grandgérard
- Attention à ce que l'adresse soit disponible: voir http://dev-eole.ac-dijon.fr/projects/eole-interne/wiki/Adressage_ip 
20 76 Gilles Grandgérard
21 42 Gilles Grandgérard
il faut créer un script dans 'configuration/gateway/' dont le nom sera 'routeur_<user_nebula>.sh'. (Tips: copier un fichier existant !)
22 25 Gilles Grandgérard
Penser à mettre les droits d'execution.
23 1 Gilles Grandgérard
24 22 Gilles Grandgérard
<pre>
25 22 Gilles Grandgérard
IP_EOLE=<fin de l'Ip sur le reseau EOLE>
26 69 Gilles Grandgérard
IP_ONE=<fin de l'Ip sur le reseau ONE>
27 62 Gilles Grandgérard
IP_UTILISATEUR=<ip du poste de travail>
28 84 Gilles Grandgérard
MAIL_UTILISATEUR=<adresse mail du developpeur>
29 22 Gilles Grandgérard
</pre>
30 1 Gilles Grandgérard
31 84 Gilles Grandgérard
+NB+ : 
32 84 Gilles Grandgérard
*IP_UTILISATEUR* est facultative, la variable est utilisée pour envoyer des send-notify au travers du réseau...
33 84 Gilles Grandgérard
*MAIL_UTILISATEUR* est facultative, la variable est utilisée pour pour la redirection postfix sur la gateway.
34 62 Gilles Grandgérard
35 40 Gilles Grandgérard
h2. A.3) Ajout de la clef publique ssh dans eole-ci-tests/security/authorized_keys
36 1 Gilles Grandgérard
37 30 Gérald Schwartzmann
Les clefs publiques SSH présentes dans eole-ci-tests/security/authorized_keys sont automatiquement concatenées dans /root/.ssh/authorized_keys au 1er démarrage de la VM.
38 1 Gilles Grandgérard
L'acces a chaque VM peut se faire sans mot de passe.
39 1 Gilles Grandgérard
40 1 Gilles Grandgérard
Utiliser le nom 'user@hostname' pour votre fichier de cle.
41 1 Gilles Grandgérard
42 40 Gilles Grandgérard
h2. A.4) Commit
43 1 Gilles Grandgérard
44 1 Gilles Grandgérard
<pre>
45 82 Laurent Flori
git commit -am "ajout de l'utisateur <user>"
46 1 Gilles Grandgérard
git push
47 1 Gilles Grandgérard
</pre>
48 1 Gilles Grandgérard
49 42 Gilles Grandgérard
h2. A.5) Publication de la clef et du fichier routeur
50 1 Gilles Grandgérard
51 77 Gilles Grandgérard
Attendre que les Jenkins publient le commit vers les VM (15 minutes)
52 1 Gilles Grandgérard
53 76 Gilles Grandgérard
OU, faire :
54 78 Daniel Dehennin
* Ouvrir votre navigateur, et Aller pour BODANOV : http://jenkins.eole.lan/view/Dev/job/git-clone-eole-ci-tests-to-all-vm/ ou pour ONE : http://jenkins2.eole.lan/view/Tous/job/git-clone-eole-ci-tests-to-all-vm/
55 77 Gilles Grandgérard
* Se connecter
56 54 Fabrice Barconnière
* Cliquer sur *Lancer un build*
57 42 Gilles Grandgérard
* Dans l"historique des builds" un build apparait. Cliquer sur le lien
58 42 Gilles Grandgérard
* Le message de commit 'git' doit apparaitre dans la sortie
59 26 Gilles Grandgérard
60 79 Daniel Dehennin
h2. A.6) Initialiser les réseaux dans Bogdanov
61 1 Gilles Grandgérard
62 36 Gilles Grandgérard
* Ouvrir votre navigateur, et Aller http://jenkins.eole.lan/view/Dev/job/genere-modele-reseau-dans-nebula/build?delay=0sec
63 77 Gilles Grandgérard
* Se connecter 
64 37 Gilles Grandgérard
* Saisir le nom d'utilisateur et le mot de passe
65 60 Klaas TJEBBES
* Cliquer sur *Build*
66 60 Klaas TJEBBES
* Dans "historique des builds" un build apparait. Cliquer sur le lien
67 38 Gilles Grandgérard
* Cliquer ensuite sur le lien 'Console Output'
68 37 Gilles Grandgérard
* Le texte affiche la sortie standard du processus de création des réseaux virtuels
69 1 Gilles Grandgérard
 
70 79 Daniel Dehennin
h2. A.7) Initialiser les réseaux dans Yggdrasil
71 1 Gilles Grandgérard
72 83 Gilles Grandgérard
* DEMANDER A GILLES
73 83 Gilles Grandgérard
* Ouvrir votre navigateur, et Aller http://jenkins2.eole.lan/view/Tous/job/genere-modele-reseau-dans-nebula/build?delay=0sec
74 79 Daniel Dehennin
* Se connecter 
75 79 Daniel Dehennin
* Saisir le nom d'utilisateur et le mot de passe
76 79 Daniel Dehennin
* Cliquer sur *Build*
77 79 Daniel Dehennin
* Dans "historique des builds" un build apparait. Cliquer sur le lien
78 79 Daniel Dehennin
* Cliquer ensuite sur le lien 'Console Output'
79 79 Daniel Dehennin
* Le texte affiche la sortie standard du processus de création des réseaux virtuels
80 79 Daniel Dehennin
81 79 Daniel Dehennin
h2. A.8) Lancer la gateway
82 36 Gilles Grandgérard
83 70 Gilles Grandgérard
* Aller dans OpenNebula (https://bogdanov.eole.lan/)
84 35 Gérald Schwartzmann
* Aller dans 'Virtual Resources', puis 'Templates'
85 35 Gérald Schwartzmann
* Chercher 'gateway'
86 35 Gérald Schwartzmann
* Cliquer sur 'Instantiate'.La VM démarre.
87 28 Gilles Grandgérard
88 35 Gérald Schwartzmann
* Vérification
89 81 Gérald Schwartzmann
** Se connecter en VNC avec 'eole/$eole&123456$'
90 35 Gérald Schwartzmann
** Taper 'ip addr' ==> vérifier l'IP SW EOLE
91 32 Gérald Schwartzmann
* lancer :
92 32 Gérald Schwartzmann
<pre>
93 32 Gérald Schwartzmann
 ssh root@<ipgateway>  ==> la connexion doit être sans mot de passe car la clef
94 32 Gérald Schwartzmann
</pre>
95 26 Gilles Grandgérard
96 40 Gilles Grandgérard
h1. B) Préparation du poste de travail
97 26 Gilles Grandgérard
98 40 Gilles Grandgérard
h2. B.1) Modifier /etc/hosts
99 26 Gilles Grandgérard
100 35 Gérald Schwartzmann
* Ajouter votre gateway : 
101 26 Gilles Grandgérard
<pre>
102 55 Fabrice Barconnière
192.168.230.<IP> gateway.ac-test.fr gateway
103 1 Gilles Grandgérard
</pre>
104 26 Gilles Grandgérard
105 26 Gilles Grandgérard
* Vérification
106 26 Gilles Grandgérard
<pre>
107 35 Gérald Schwartzmann
ping gateway
108 26 Gilles Grandgérard
ping gateway.ac-test.fr
109 26 Gilles Grandgérard
</pre>
110 26 Gilles Grandgérard
111 40 Gilles Grandgérard
h2. B.2) Ajouter tous les noms des machines ac-test.fr dans /etc/hosts
112 40 Gilles Grandgérard
113 73 Daniel Dehennin
*ATTENTION* : Cette étape n’est nécessaire que si vous n’utilisez pas le DNS EOLE (192.168.232.2)
114 85 Gilles Grandgérard
*ATTENTION* : certains hosts ont été inscrits dans le DNS EOLE. Pour eux, il n'y a pas besoin d'entrée.
115 73 Daniel Dehennin
116 58 Fabrice Barconnière
* Concatener le fichier (eole-ci-tests.git)/scripts/host dans /etc/hosts (connecté root)
117 56 Fabrice Barconnière
<pre>
118 1 Gilles Grandgérard
cd (eole-ci-tests.git)/scripts/
119 1 Gilles Grandgérard
cat hosts >> /etc/hosts
120 33 Gérald Schwartzmann
</pre>
121 1 Gilles Grandgérard
122 40 Gilles Grandgérard
h2. B.3) Activation des routes
123 40 Gilles Grandgérard
124 64 Gilles Grandgérard
* Executer le fichier :
125 64 Gilles Grandgérard
<pre>
126 64 Gilles Grandgérard
# cd <depot eole-ci-tests.git>
127 64 Gilles Grandgérard
# ./scripts/gateway-up.sh
128 64 Gilles Grandgérard
</pre>
129 33 Gérald Schwartzmann
Les routes sont inscrites...
130 1 Gilles Grandgérard
131 67 Gilles Grandgérard
REMARQUES:
132 67 Gilles Grandgérard
* Ce script devra être lancé à chaque redémarrage de votre machine !*
133 85 Gilles Grandgérard
134 85 Gilles Grandgérard
* Si vous utiliser plusieurs Gateway (one et bodgdanov), vous pouvez être amené à vouloir changer de gateway. Pour supprimer les routes actuelles, faites :
135 85 Gilles Grandgérard
<pre>
136 85 Gilles Grandgérard
# cd <depot eole-ci-tests.git>
137 85 Gilles Grandgérard
# ./scripts/gateway-down.sh
138 85 Gilles Grandgérard
</pre>
139 85 Gilles Grandgérard
140 85 Gilles Grandgérard
* Pour basculer vers une gateway précise, tapez 
141 85 Gilles Grandgérard
<pre>
142 85 Gilles Grandgérard
# cd <depot eole-ci-tests.git>
143 85 Gilles Grandgérard
# ./scripts/gateway-up.sh <ip_gateway_cible>
144 85 Gilles Grandgérard
</pre>
145 85 Gilles Grandgérard
146 64 Gilles Grandgérard
147 1 Gilles Grandgérard
h2. B.4) Lancement du daemon send notify
148 64 Gilles Grandgérard
149 66 Gilles Grandgérard
* Si vous le souhaitez, Executer le fichier :
150 64 Gilles Grandgérard
<pre>
151 64 Gilles Grandgérard
# cd <depot eole-ci-tests.git>
152 72 Gilles Grandgérard
# nohup python ./scripts/server_notify_network.py &
153 64 Gilles Grandgérard
</pre>
154 64 Gilles Grandgérard
155 65 Gilles Grandgérard
REMARQUES:
156 65 Gilles Grandgérard
* Ce script devra être lancé à chaque redémarrage de votre machine !*
157 72 Gilles Grandgérard
* Le port 50000 est ouvert en UDP sur le poste client. Il attend des messages UDP pour les afficher avec send-notify *
158 1 Gilles Grandgérard
159 65 Gilles Grandgérard
h2. B.5) Selection de l'identitée SSH ( Si besoin)
160 1 Gilles Grandgérard
161 74 Daniel Dehennin
* Dans le cas, ou vous utilisez plusieurs clef publique ssh, Modifier le fichier *@~/.ssh/config@* en ajoutant :
162 39 Benjamin Bohard
<pre>
163 40 Gilles Grandgérard
Host *.ac-test.fr
164 1 Gilles Grandgérard
   IdentityFile ~/.ssh/<fichier de la cle copiée dans eole-ci-tests>
165 1 Gilles Grandgérard
</pre>
166 39 Benjamin Bohard
167 65 Gilles Grandgérard
h2. B.6) Astuce SSH knows hosts
168 51 Gilles Grandgérard
169 75 Daniel Dehennin
* Pour éviter les message know_hosts, vous pouvez modifier le fichier *@.ssh/config@* en ajoutant :
170 51 Gilles Grandgérard
<pre>
171 51 Gilles Grandgérard
# Use daily destroyed file to avoid pain with VMs
172 51 Gilles Grandgérard
Host *.ac-test.fr 192.168.230.1?? 192.168.230.2??
173 51 Gilles Grandgérard
  CheckHostIP no
174 1 Gilles Grandgérard
  UserKnownHostsFile /tmp/ac-test.fr
175 51 Gilles Grandgérard
  StrictHostKeyChecking no
176 51 Gilles Grandgérard
</pre>
177 51 Gilles Grandgérard
178 65 Gilles Grandgérard
h2. B.7) Vérification
179 27 Gilles Grandgérard
180 72 Gilles Grandgérard
* Aller dans OpenNebual (https://bogdanov.eole.lan/)
181 44 Gilles Grandgérard
* Aller dans 'Virtual Resources', puis 'Templates'
182 44 Gilles Grandgérard
* Chercher 'aca.eolebase'
183 44 Gilles Grandgérard
* Cliquer sur 'Instantiate'.La VM démarre.
184 44 Gilles Grandgérard
* Se connecter en VNC avec 'eole/$eole&123456'
185 27 Gilles Grandgérard
* Taper 'ip addr' ==> vérifier l'IP SW EOLE
186 27 Gilles Grandgérard
187 45 Gilles Grandgérard
188 1 Gilles Grandgérard
h1. C) Utilisation d'un template 
189 1 Gilles Grandgérard
190 62 Gilles Grandgérard
h2. C.1) Démarrer une machine et se connecter dessus
191 1 Gilles Grandgérard
192 62 Gilles Grandgérard
* Choisir la machine dans Nebula 
193 62 Gilles Grandgérard
* l'instancier
194 62 Gilles Grandgérard
* lancer dans une console
195 62 Gilles Grandgérard
196 59 Gérald Schwartzmann
<pre>
197 59 Gérald Schwartzmann
# ssh root@nomDeMachine
198 59 Gérald Schwartzmann
</pre>
199 59 Gérald Schwartzmann
200 59 Gérald Schwartzmann
Exemple :
201 59 Gérald Schwartzmann
202 59 Gérald Schwartzmann
<pre>
203 59 Gérald Schwartzmann
# ssh root@amonecole.etb3.ac-test.fr
204 59 Gérald Schwartzmann
</pre>
205 1 Gilles Grandgérard
206 62 Gilles Grandgérard
h2. C.2) Obtenir le contexte de la machine
207 62 Gilles Grandgérard
208 72 Gilles Grandgérard
Le contexte nécessite de monter le partage VirtFs eole-ci-tests. pour cela faire :
209 1 Gilles Grandgérard
<pre>
210 63 Gilles Grandgérard
# /root/mount.eole-ci-tests
211 63 Gilles Grandgérard
# . /mnt/eole-ci-tests/scripts/getVMContext.sh 
212 1 Gilles Grandgérard
</pre>
213 1 Gilles Grandgérard
214 62 Gilles Grandgérard
Le script getVMContext.sh permet de charger les variables contextuelles du module.
215 62 Gilles Grandgérard
Attention : il faut le sourcer !
216 59 Gérald Schwartzmann
217 62 Gilles Grandgérard
Le résultat est de la forme :
218 59 Gérald Schwartzmann
<pre>
219 59 Gérald Schwartzmann
root@amonecole:/mnt/eole-ci-tests/scripts# ./getVMContext.sh 
220 59 Gérald Schwartzmann
VM_ONE           = 
221 59 Gérald Schwartzmann
VM_ID            = 7295
222 59 Gérald Schwartzmann
VM_OWNER         = gerald
223 59 Gérald Schwartzmann
VM_MACHINE       = etb3.amonecole
224 59 Gérald Schwartzmann
VM_MAJAUTO       = DEV
225 59 Gérald Schwartzmann
VM_VERSIONMAJEUR = 2.4.1
226 59 Gérald Schwartzmann
VM_MODULE        = amonecole
227 59 Gérald Schwartzmann
VM_CONTAINER     = oui
228 59 Gérald Schwartzmann
VM_HOSTNAME      = amonecole
229 59 Gérald Schwartzmann
VM_DNSNAME       = amonecole.etb3.ac-test.fr
230 59 Gérald Schwartzmann
VM_ETABLISSEMENT = etb3
231 59 Gérald Schwartzmann
VM_ETH0_IP       = 192.168.0.33
232 59 Gérald Schwartzmann
VM_ETH0_GW       = 192.168.0.1
233 59 Gérald Schwartzmann
VM_ETH1_IP       = 10.3.2.1
234 59 Gérald Schwartzmann
---
235 1 Gilles Grandgérard
root@amonecole:/mnt/eole-ci-tests/scripts#
236 59 Gérald Schwartzmann
</pre>
237 1 Gilles Grandgérard
238 62 Gilles Grandgérard
h2. C.3) Configurer la machine
239 1 Gilles Grandgérard
240 68 Gérald Schwartzmann
<pre>
241 68 Gérald Schwartzmann
cd /mnt/eole-ci-tests/scripts/
242 68 Gérald Schwartzmann
</pre>
243 68 Gérald Schwartzmann
244 68 Gérald Schwartzmann
* Le script *configure-vm.sh* permet d'appliquer une configuration à la VM. 
245 62 Gilles Grandgérard
* Ce script appliquera :
246 62 Gilles Grandgérard
- la commande Maj-Auto adaptée au contexte,
247 62 Gilles Grandgérard
- Copiera le fichier 'config.eol' correspondant à la machine et la version 
248 62 Gilles Grandgérard
- lancera l'instance sans questions
249 62 Gilles Grandgérard
250 59 Gérald Schwartzmann
Pour obtenir de l'aide :
251 59 Gérald Schwartzmann
252 1 Gilles Grandgérard
<pre>
253 59 Gérald Schwartzmann
# ./configure-vm.sh -h
254 59 Gérald Schwartzmann
</pre>
255 59 Gérald Schwartzmann
256 62 Gilles Grandgérard
Pour lancer l'instanciation avec le configuration par 'default'
257 1 Gilles Grandgérard
258 1 Gilles Grandgérard
<pre>
259 1 Gilles Grandgérard
# ./configure-vm.sh -M instance
260 1 Gilles Grandgérard
</pre>
261 1 Gilles Grandgérard
262 62 Gilles Grandgérard
Pour lancer l'instanciation avec le configuration par 'hamaster'
263 62 Gilles Grandgérard
264 62 Gilles Grandgérard
<pre>
265 62 Gilles Grandgérard
# ./configure-vm.sh -M instance -C hamaster
266 62 Gilles Grandgérard
</pre>
267 62 Gilles Grandgérard
268 62 Gilles Grandgérard
Pour ne copier que la configuration 'hamaster'
269 62 Gilles Grandgérard
270 62 Gilles Grandgérard
<pre>
271 72 Gilles Grandgérard
# ./configure-vm.sh -M configeol -C hamaster
272 62 Gilles Grandgérard
</pre>
273 62 Gilles Grandgérard
274 62 Gilles Grandgérard
h2. C.4)