Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:centos:8:lcf1000:l1004 [2023/11/10 09:00] – admin | elearning:workbooks:centos:8:lcf1000:l1004 [2023/11/12 11:47] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 30: | Ligne 30: | ||
L' | L' | ||
- | |||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | ||
^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ||
Ligne 42: | Ligne 40: | ||
| VM | targetb.i2tch.loc | 10.0.2.53 | CentOS | | VM | targetb.i2tch.loc | 10.0.2.53 | CentOS | ||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | + | =====LAB #1 - La Commande chef-run===== |
- | ^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | + | ====1.1 - Présentation==== |
- | | VM | workstation.ittraining.loc | 10.0.3.111 | Ubuntu | + | |
- | | VM | client.ittraining.loc | 10.0.3.112 | Ubuntu | + | |
- | | VM | web01.i2tch.loc | 10.0.3.54 | Debian | + | |
- | | VM | web02.i2tch.loc | 10.0.3.55 | Debian | + | |
- | | VM | web03.i2tch.loc | 10.0.3.56 | Debian | + | |
- | | VM | targeta.i2tch.loc | 10.0.3.52 | Debian | + | |
- | | VM | targetb.i2tch.loc | 10.0.3.53 | CentOS | + | |
- | Commencez donc par modifier le fichier | + | La commande |
- | Stagiaires **11**, **12**, **14**, **15**, | + | Cette commande : |
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | ====1.2 - Utiliser chef-run sur un Client Unique==== | ||
+ | |||
+ | Commencez par modifier le fichier | ||
< | < | ||
Ligne 76: | Ligne 76: | ||
ff02::2 ip6-allrouters | ff02::2 ip6-allrouters | ||
</ | </ | ||
- | |||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | root@workstation: | ||
- | 127.0.0.1 | ||
- | 127.0.1.1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.112 | ||
- | 10.0.3.54 | ||
- | 10.0.3.55 | ||
- | 10.0.3.56 | ||
- | |||
- | # The following lines are desirable for IPv6 capable hosts | ||
- | ::1 | ||
- | fe00::0 ip6-localnet | ||
- | ff00::0 ip6-mcastprefix | ||
- | ff02::1 ip6-allnodes | ||
- | ff02::2 ip6-allrouters | ||
- | </ | ||
- | |||
- | =====LAB #1 - La Commande chef-run===== | ||
- | |||
- | ====1.1 - Présentation==== | ||
- | |||
- | La commande **chef-run** permet d' | ||
- | |||
- | Cette commande : | ||
- | |||
- | * ne nécessite pas de Chef Infra Server, | ||
- | * ne nécessite pas de pré-installation de Chef Client sur le(s) client(s), | ||
- | * peut aussi exécuter une Recette ou un Cookbook, | ||
- | * peut configurer de multiples clients dans la même commande. | ||
- | |||
- | ====1.2 - Utiliser chef-run sur un Client Unique==== | ||
Utilisez la commande **chef-run** pour arrêter le service apache2 sur la VM **web01.i2tch.loc** : | Utilisez la commande **chef-run** pour arrêter le service apache2 sur la VM **web01.i2tch.loc** : | ||
Ligne 138: | Ligne 101: | ||
</ | </ | ||
- | Connectez-vous à la VM **web01.i2tch.loc** à partir de votre VM **workstation.ittraining.loc**. | + | Connectez-vous à la VM **web01.i2tch.loc** à partir de votre VM **workstation.ittraining.loc** : |
- | + | ||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | + | |
< | < | ||
Ligne 159: | Ligne 120: | ||
permitted by applicable law. | permitted by applicable law. | ||
Last login: Thu Nov 2 13:35:52 2023 from 10.0.2.1 | Last login: Thu Nov 2 13:35:52 2023 from 10.0.2.1 | ||
- | </ | ||
- | |||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | The authenticity of host 'web01 (10.0.3.54)' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | Debian GNU/Linux 9 | ||
- | trainee@web01' | ||
- | Linux web01.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Thu Nov 2 13:35:52 2023 from 10.0.3.1 | ||
</ | </ | ||
Ligne 371: | Ligne 311: | ||
</ | </ | ||
- | Vérifiez ensuite le statut du service apache2 sur les deux clients **web02.i2tch.loc** et **web03.i2tch.loc**. | + | Vérifiez ensuite le statut du service apache2 sur les deux clients **web02.i2tch.loc** et **web03.i2tch.loc** : |
- | + | ||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | + | |
< | < | ||
Ligne 434: | Ligne 372: | ||
permitted by applicable law. | permitted by applicable law. | ||
Last login: Thu Nov 2 13:57:50 2023 from 10.0.2.1 | Last login: Thu Nov 2 13:57:50 2023 from 10.0.2.1 | ||
- | |||
- | trainee@web03: | ||
- | Mot de passe : fenestros | ||
- | |||
- | root@web03: | ||
- | ● apache2.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Process: 1390 ExecStop=/ | ||
- | Process: 463 ExecStart=/ | ||
- | Main PID: 497 (code=exited, | ||
- | |||
- | nov. 02 13:59:37 web03.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | ||
- | nov. 02 13:59:38 web03.i2tch.loc systemd[1]: Started The Apache HTTP Server. | ||
- | nov. 02 14:12:36 web03.i2tch.loc systemd[1]: Stopping The Apache HTTP Server... | ||
- | nov. 02 14:12:37 web03.i2tch.loc systemd[1]: Stopped The Apache HTTP Server. | ||
- | </ | ||
- | |||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | The authenticity of host 'web02 (10.0.3.55)' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | Debian GNU/Linux 9 | ||
- | trainee@web02' | ||
- | Linux web02.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Thu Nov 2 13:56:42 2023 from 10.0.3.1 | ||
- | |||
- | trainee@web02: | ||
- | Mot de passe : fenestros | ||
- | |||
- | root@web02: | ||
- | ● apache2.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Process: 1406 ExecStop=/ | ||
- | Process: 445 ExecStart=/ | ||
- | Main PID: 473 (code=exited, | ||
- | |||
- | nov. 02 13:59:22 web02.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | ||
- | nov. 02 13:59:22 web02.i2tch.loc systemd[1]: Started The Apache HTTP Server. | ||
- | nov. 02 14:12:37 web02.i2tch.loc systemd[1]: Stopping The Apache HTTP Server... | ||
- | nov. 02 14:12:37 web02.i2tch.loc systemd[1]: Stopped The Apache HTTP Server. | ||
- | </ | ||
- | |||
- | < | ||
- | root@web02: | ||
- | déconnexion | ||
- | |||
- | trainee@web02: | ||
- | déconnexion | ||
- | Connection to web02 closed. | ||
- | |||
- | root@workstation: | ||
- | The authenticity of host 'web03 (10.0.3.56)' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | Debian GNU/Linux 9 | ||
- | trainee@web03' | ||
- | Linux web03.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Thu Nov 2 13:57:50 2023 from 10.0.3.1 | ||
trainee@web03: | trainee@web03: | ||
Ligne 577: | Ligne 436: | ||
====1.4 - Utiliser chef-run avec un Cookbook==== | ====1.4 - Utiliser chef-run avec un Cookbook==== | ||
- | Installez le paquet **git* : | + | Installez le paquet **git** : |
< | < | ||
Ligne 599: | Ligne 458: | ||
</ | </ | ||
- | Le service apache2 ayant été arrêté précédemment, | + | Le service apache2 ayant été arrêté précédemment, |
- | + | ||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** | + | |
< | < | ||
Ligne 616: | Ligne 473: | ||
permitted by applicable law. | permitted by applicable law. | ||
Last login: Thu Nov 2 14:08:53 2023 from 10.0.2.1 | Last login: Thu Nov 2 14:08:53 2023 from 10.0.2.1 | ||
- | |||
- | trainee@web01: | ||
- | Mot de passe : fenestros | ||
- | |||
- | root@web01: | ||
- | ● apache2.service - The Apache HTTP Server | ||
- | | ||
- | | ||
- | Process: 4208 ExecStop=/ | ||
- | Process: 4360 ExecStart=/ | ||
- | Main PID: 4364 (apache2) | ||
- | Tasks: 55 (limit: 4915) | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | nov. 02 14:40:59 web01.i2tch.loc systemd[1]: Starting The Apache HTTP Server... | ||
- | nov. 02 14:40:59 web01.i2tch.loc systemd[1]: Started The Apache HTTP Server. | ||
- | </ | ||
- | |||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | Debian GNU/Linux 9 | ||
- | trainee@web01' | ||
- | Linux web01.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Thu Nov 2 14:08:53 2023 from 10.0.3.1 | ||
trainee@web01: | trainee@web01: | ||
Ligne 751: | Ligne 572: | ||
</ | </ | ||
- | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_VNC** | + | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_VNC**. |
- | Ouvrez le navigateur Web et naviguez à l' | + | Ouvrez le navigateur Web et naviguez à l' |
{{ : | {{ : | ||
Ligne 777: | Ligne 598: | ||
{{ : | {{ : | ||
- | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_SSH** | + | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_SSH**. |
Modifiez maintenant la configuration du client **client.ittraining.loc** en référencant le Rôle dans le **run_list**. Sauvegardez et quittez le fichier : | Modifiez maintenant la configuration du client **client.ittraining.loc** en référencant le Rôle dans le **run_list**. Sauvegardez et quittez le fichier : | ||
Ligne 965: | Ligne 786: | ||
====3.3 - Ajout de Clients au Chef Infra Server==== | ====3.3 - Ajout de Clients au Chef Infra Server==== | ||
- | ===Stagiaires **11**, **12**, **14**, **15**, **16** et **17**=== | + | Configurez deux nouveaux clients **targeta** et **targetb** |
- | + | ||
- | Configurez deux nouveaux clients **targeta** et **targetb**. | + | |
< | < | ||
Ligne 1223: | Ligne 1042: | ||
| | ||
to file / | to file / | ||
- | ... | ||
- | Chef Infra Client finished, 0/0 resources updated in 03 seconds | ||
- | [2023-11-03T16: | ||
- | </ | ||
- | |||
- | ===Stagiaires **18**, **19**, **20**, **21**, **22** et **23**=== | ||
- | |||
- | Configurez deux nouveaux clients **targeta** et **targetb**. | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | The authenticity of host ' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | Debian GNU/Linux 9 | ||
- | trainee@10.0.3.52' | ||
- | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | |||
- | The programs included with the Debian GNU/Linux system are free software; | ||
- | the exact distribution terms for each program are described in the | ||
- | individual files in / | ||
- | |||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
- | permitted by applicable law. | ||
- | Last login: Sun Mar 21 08:47:45 2021 from 10.0.3.10 | ||
- | |||
- | trainee@targeta: | ||
- | Mot de passe : fenestros | ||
- | </ | ||
- | |||
- | Editez la directive **PermitRootLogin** du fichier **/ | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | ... | ||
- | PermitRootLogin yes | ||
- | ... | ||
- | |||
- | root@targeta: | ||
- | </ | ||
- | |||
- | Editez ensuite le fichier **/ | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | root@targeta: | ||
- | 127.0.0.1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.52 | ||
- | 10.0.3.53 | ||
- | |||
- | |||
- | # The following lines are desirable for IPv6 capable hosts | ||
- | ::1 | ||
- | ff02::1 ip6-allnodes | ||
- | ff02::2 ip6-allrouters | ||
- | </ | ||
- | |||
- | Modifiez le FQDN de la VM : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | </ | ||
- | |||
- | Mettez à jour les dépôts des paquets : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | |||
- | root@targeta: | ||
- | Ign:1 http:// | ||
- | Réception de:2 http:// | ||
- | Réception de:3 http:// | ||
- | Réception de:4 http:// | ||
- | Réception de:5 http:// | ||
- | Réception de:6 http:// | ||
- | Réception de:7 http:// | ||
- | 21,2 Mo réceptionnés en 6s (3 302 ko/s) | ||
- | Lecture des listes de paquets... Fait | ||
- | Construction de l' | ||
- | Lecture des informations d' | ||
- | 226 packages can be upgraded. Run 'apt list --upgradable' | ||
- | </ | ||
- | |||
- | Créez le répertoire **/ | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | </ | ||
- | |||
- | Quittez la VM **targeta** : | ||
- | |||
- | < | ||
- | root@targeta: | ||
- | déconnexion | ||
- | trainee@targeta: | ||
- | déconnexion | ||
- | Connection to 10.0.3.52 closed. | ||
- | </ | ||
- | |||
- | Utilisez la commande **knife bootstrap** pour référencer le client avec le Chef Infra Server : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | Connecting to 10.0.3.52 | ||
- | The authenticity of host ' | ||
- | fingerprint is SHA256: | ||
- | |||
- | Are you sure you want to continue connecting | ||
- | ? (Y/N) Y | ||
- | Connecting to 10.0.3.52 | ||
- | Creating new client for web02 | ||
- | Creating new node for web02 | ||
- | Bootstrapping 10.0.3.52 | ||
- | | ||
- | downloading https:// | ||
- | to file / | ||
- | trying wget... | ||
- | | ||
- | Getting information for chef stable 15 for debian... | ||
- | downloading https:// | ||
- | to file / | ||
- | | ||
- | | ||
- | sha256 | ||
- | url | ||
- | version 15.17.4 | ||
- | ... | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | Connectez-vous à la VM **targetb** : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | The authenticity of host ' | ||
- | ECDSA key fingerprint is SHA256: | ||
- | Are you sure you want to continue connecting (yes/no)? yes | ||
- | Warning: Permanently added ' | ||
- | trainee@10.0.3.53' | ||
- | Last login: Sun Mar 21 08:53:18 2021 from 10.0.3.10 | ||
- | [trainee@targetb ~]$ su - | ||
- | Password: fenestros | ||
- | Last login: dim. mars 21 08:53:25 CET 2021 on pts/0 | ||
- | </ | ||
- | |||
- | Modifiez la directive **PermitRootLogin** du fichier **/ | ||
- | |||
- | < | ||
- | [root@targetb ~]# vi / | ||
- | |||
- | [root@targetb ~]# cat / | ||
- | # | ||
- | |||
- | # This is the sshd server system-wide configuration file. See | ||
- | # sshd_config(5) for more information. | ||
- | |||
- | # This sshd was compiled with PATH=/ | ||
- | |||
- | # The strategy used for options in the default sshd_config shipped with | ||
- | # OpenSSH is to specify options with their default value where | ||
- | # possible, but leave them commented. | ||
- | # default value. | ||
- | |||
- | # If you want to change the port on a SELinux system, you have to tell | ||
- | # SELinux about this change. | ||
- | # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER | ||
- | ... | ||
- | PermitRootLogin yes | ||
- | ... | ||
- | |||
- | [root@targetb ~]# systemctl restart sshd | ||
- | </ | ||
- | |||
- | Editez ensuite le fichier **/ | ||
- | |||
- | < | ||
- | [root@targetb ~]# vi /etc/hosts | ||
- | |||
- | [root@targetb ~]# cat /etc/hosts | ||
- | 127.0.0.1 | ||
- | ::1 | ||
- | 10.0.3.110 | ||
- | 10.0.3.111 | ||
- | 10.0.3.52 | ||
- | 10.0.3.53 | ||
- | </ | ||
- | |||
- | Modifiez le FQDN de la VM : | ||
- | |||
- | < | ||
- | [root@targetb ~]# hostnamectl set-hostname web03.i2tch.loc | ||
- | </ | ||
- | |||
- | La VM **targetb** étant une CentOS 7, le paquet **nginx** est disponible dans le dépôt **epel-release**. Installez donc ce dépôt : | ||
- | |||
- | < | ||
- | [root@targetb ~]# yum install epel-release | ||
- | </ | ||
- | |||
- | Créez le répertoire **/ | ||
- | |||
- | < | ||
- | [root@targetb ~]# mkdir -p / | ||
- | </ | ||
- | |||
- | Déconnectez-vous de la VM : | ||
- | |||
- | < | ||
- | [root@targetb ~]# exit | ||
- | déconnexion | ||
- | |||
- | trainee@targetb: | ||
- | déconnexion | ||
- | </ | ||
- | |||
- | Utilisez la commande **knife bootstrap** pour référencer le client avec le Chef Infra Server : | ||
- | |||
- | < | ||
- | root@workstation: | ||
- | --ssh-user: This flag is deprecated. Use -U/ | ||
- | --ssh-password: | ||
- | Connecting to 10.0.3.53 | ||
- | The authenticity of host ' | ||
- | fingerprint is SHA256: | ||
- | |||
- | Are you sure you want to continue connecting | ||
- | ? (Y/N) Y | ||
- | Connecting to 10.0.3.53 | ||
- | Creating new client for web03 | ||
- | Creating new node for web03 | ||
- | Bootstrapping 10.0.3.53 | ||
- | | ||
- | downloading https:// | ||
- | to file / | ||
- | trying wget... | ||
- | | ||
- | Getting information for chef stable 15 for el... | ||
- | downloading https:// | ||
- | to file / | ||
- | | ||
- | | ||
- | sha256 | ||
- | url | ||
- | version 15.17.4 | ||
... | ... | ||
Chef Infra Client finished, 0/0 resources updated in 03 seconds | Chef Infra Client finished, 0/0 resources updated in 03 seconds | ||
Ligne 1485: | Ligne 1049: | ||
====3.4 - Configuration des Environnements==== | ====3.4 - Configuration des Environnements==== | ||
- | Editez le fichier **/ | + | Editez le fichier **/ |
- | + | ||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | + | |
< | < | ||
Ligne 1508: | Ligne 1070: | ||
</ | </ | ||
- | Stagiaires **18**, **19**, **20**, **21**, **22** et **23** : | + | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_VNC**. |
- | + | ||
- | < | + | |
- | root@workstation: | + | |
- | root@workstation: | + | |
- | 127.0.0.1 | + | |
- | 127.0.1.1 | + | |
- | 10.0.3.110 | + | |
- | 10.0.3.111 | + | |
- | 10.0.3.112 | + | |
- | 10.0.3.52 | + | |
- | 10.0.3.53 | + | |
- | + | ||
- | # The following lines are desirable for IPv6 capable hosts | + | |
- | ::1 | + | |
- | fe00::0 ip6-localnet | + | |
- | ff00::0 ip6-mcastprefix | + | |
- | ff02::1 ip6-allnodes | + | |
- | ff02::2 ip6-allrouters | + | |
- | </ | + | |
- | + | ||
- | Connectez-vous ensuite à votre VM **ChefServer_10.0.2.110_VNC** | + | |
- | Ouvrez le navigateur Web et naviguez à l' | + | Ouvrez le navigateur Web et naviguez à l' |
{{ : | {{ : |