Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:centos:8:lcf1000:l1004 [2023/11/02 17:16] – created admin | elearning:workbooks:centos:8:lcf1000:l1004 [2023/11/12 11:47] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 22: | Ligne 22: | ||
* LAB #3 - Configuration des Clients en fonction de l' | * LAB #3 - Configuration des Clients en fonction de l' | ||
* 3.1 - Préparation | * 3.1 - Préparation | ||
- | * 3.2 - Installation | + | * 3.2 - Création des Cookbooks |
+ | * 3.3 - Ajout de Clients au Chef Infra Server | ||
+ | * 3.4 - Configuration des Environnements | ||
+ | * 3.5 - Exécution avec Environnements | ||
=====Infrastructure===== | =====Infrastructure===== | ||
L' | L' | ||
- | |||
- | Stagiaires **11**, **12**, **14**, **15**, **16** et **17** : | ||
^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ^ Type Machine ^ FQDN ^ IP ^ OS ^ Version | ||
- | | VM | workstation.ittraining.loc | 10.0.2.111 | Ubuntu | + | | VM | workstation.ittraining.loc | 10.0.2.111 | Ubuntu |
- | | VM | client.ittraining.loc | 10.0.2.112 | Ubuntu | + | | VM | client.ittraining.loc | 10.0.2.112 | Ubuntu |
- | | VM | web01.i2tch.loc | 10.0.2.54 | Debian | + | | VM | web01.i2tch.loc | 10.0.2.54 | Debian |
- | | VM | web02.i2tch.loc | 10.0.2.55 | Debian | + | | VM | web02.i2tch.loc | 10.0.2.55 | Debian |
- | | VM | web02.i2tch.loc | 10.0.2.56 | Debian | + | | VM | web03.i2tch.loc | 10.0.2.56 | Debian |
+ | | VM | targeta.i2tch.loc | 10.0.2.52 | Debian | ||
+ | | 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 | web02.i2tch.loc | 10.0.3.56 | Debian | + | |
- | 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 69: | 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 recipe 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 131: | 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 152: | 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 334: | Ligne 281: | ||
< | < | ||
- | ot@workstation: | + | root@workstation: |
Recipe: cw_service:: | Recipe: cw_service:: | ||
* service[apache2] action start | * service[apache2] action start | ||
Ligne 454: | Ligne 401: | ||
</ | </ | ||
- | ====1.4 - Utiliser | + | Dans le cas d'une erreur de l' |
- | Utilisez maintenant la commande **chef-run** pour exécuter la Recipe | + | < |
+ | root@workstation: | ||
+ | [✔] Packaging cookbook... done! | ||
+ | [✔] Generating local policyfile... exporting... done! | ||
+ | [✖] Applying service[apache2] from resource to targets. | ||
+ | ├── [✖] [web02] Failed to converge service[apache2]. | ||
+ | └── [✖] [web03] Failed to converge service[apache2]. | ||
+ | |||
+ | One or more actions has failed. | ||
+ | |||
+ | A complete list of failures and possible resolutions can | ||
+ | be found in the file below: | ||
+ | |||
+ | / | ||
+ | |||
+ | root@workstation: | ||
+ | Host: web02 Error: CHEFCCR003: The action ' | ||
+ | Host: web03 Error: CHEFCCR003: The action ' | ||
+ | </ | ||
+ | |||
+ | Corrigez l' | ||
+ | |||
+ | < | ||
+ | root@workstation: | ||
+ | [✔] Packaging cookbook... done! | ||
+ | [✔] Generating local policyfile... exporting... done! | ||
+ | [✔] Applying service[apache2] from resource to targets. | ||
+ | ├── [✔] [web02] Successfully converged service[apache2]. | ||
+ | └── [✔] [web03] Successfully converged service[apache2]. | ||
+ | </ | ||
+ | |||
+ | ====1.4 - Utiliser chef-run avec un Cookbook==== | ||
+ | |||
+ | Installez le paquet **git** : | ||
+ | |||
+ | < | ||
+ | root@workstation: | ||
+ | </ | ||
+ | |||
+ | Utilisez la commande **git init** pour initialiser le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@workstation: | ||
+ | </ | ||
+ | |||
+ | Utilisez maintenant la commande **chef-run** pour exécuter la Recette | ||
< | < | ||
Ligne 517: | Ligne 509: | ||
====2.1 - Présentation==== | ====2.1 - Présentation==== | ||
- | Un **Rôle** est une façon logique de regrouper des clients ou **noeuds**. Chaque Rôle possède des **run-lists** pour pouvoir configurer les noeuds associés avec le Rôle. Une Run-List est un groupement de Cookbooks ou de Recipes. Pour associer un noeud à un Rôle, Chef utilise des **tags**. La manipulation des Rôles s' | + | Un **Rôle** est une façon logique de regrouper des clients ou **noeuds**. Chaque Rôle possède des **run-lists** pour pouvoir configurer les noeuds associés avec le Rôle. Une Run-List est un groupement de Cookbooks ou de Recettes. Pour associer un noeud à un Rôle, Chef utilise des **tags**. La manipulation des Rôles s' |
====2.2 - Création de Rôles==== | ====2.2 - Création de Rôles==== | ||
Ligne 580: | 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 606: | 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 666: | Ligne 658: | ||
====3.1 - Présentation==== | ====3.1 - Présentation==== | ||
- | < | + | La gestion des **Environnements** est similaire à la gestion des Rôles. Un environnement est une phase de développement telle **Développement** ou **Production**. Tous les clients font partis de l' |
- | </ | + | ====3.2 - Création des Cookbooks==== |
+ | |||
+ | Téléchargez le fichier **nginx.tar** : | ||
< | < | ||
+ | root@workstation: | ||
+ | --2023-11-03 13: | ||
+ | Resolving files-accl.zohoexternal.com (files-accl.zohoexternal.com)... 169.148.154.32, | ||
+ | Connecting to files-accl.zohoexternal.com (files-accl.zohoexternal.com)|169.148.154.32|: | ||
+ | HTTP request sent, awaiting response... 200 OK | ||
+ | Length: 30720 (30K) [application/ | ||
+ | Saving to: ‘p9zfo77176af8ccf44e4a9cff3dc316a00cf0’ | ||
+ | |||
+ | p9zfo77176af8ccf44e4a9cff3dc316a00cf0 | ||
+ | 2023-11-03 13:37:08 (372 KB/s) - ‘p9zfo77176af8ccf44e4a9cff3dc316a00cf0’ saved [30720/ | ||
</ | </ | ||
- | < | + | Renommez le fichier téléchargé et désarchivez-le : |
+ | < | ||
+ | root@workstation: | ||
+ | root@workstation: | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/spec/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/test/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
+ | nginx/ | ||
</ | </ | ||
- | < | + | Modifiez le fichier **/ |
+ | < | ||
+ | root@workstation: | ||
+ | root@workstation: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
- | < | + | Téléversez maintenant le Cookbook vers le Chef Infra Server : |
+ | < | ||
+ | root@workstation: | ||
+ | Uploading nginx [0.1.0] | ||
+ | Uploaded 1 cookbook. | ||
</ | </ | ||
- | < | + | Modifiez de nouveau le fichier **/ |
+ | < | ||
+ | root@workstation: | ||
+ | root@workstation: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
+ | |||
+ | Afin de ne pas écraser le Cookbook déjà téléversé, | ||
< | < | ||
+ | root@workstation: | ||
+ | root@workstation: | ||
+ | name ' | ||
+ | maintainer 'The Authors' | ||
+ | maintainer_email ' | ||
+ | license 'All Rights Reserved' | ||
+ | description ' | ||
+ | version ' | ||
+ | chef_version '>= 14.0' | ||
+ | # The `issues_url` points to the location where issues for this cookbook are | ||
+ | # tracked. | ||
+ | # uploaded to a Supermarket. | ||
+ | # | ||
+ | # issues_url ' | ||
+ | |||
+ | # The `source_url` points to the development repository for this cookbook. | ||
+ | # `View Source` link will be displayed on this cookbook' | ||
+ | # a Supermarket. | ||
+ | # | ||
+ | # source_url ' | ||
</ | </ | ||
+ | |||
+ | Téléversez ensuite le nouveau Cookbook vers le Chef Infra Server : | ||
< | < | ||
+ | root@workstation: | ||
+ | Uploading nginx [0.1.1] | ||
+ | Uploaded 1 cookbook. | ||
</ | </ | ||
- | < | + | ====3.3 - Ajout de Clients au Chef Infra Server==== |
- | </ | + | 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.2.52' | ||
+ | Linux targeta.i2tch.loc 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | ||
- | </code> | + | 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.2.10 | ||
+ | trainee@targeta: | ||
+ | Mot de passe : fenestros | ||
</ | </ | ||
- | < | + | Editez la directive **PermitRootLogin** du fichier **/etc/ |
- | + | ||
- | </code> | + | |
< | < | ||
+ | root@targeta: | ||
+ | |||
+ | root@targeta: | ||
+ | ... | ||
+ | PermitRootLogin yes | ||
+ | ... | ||
+ | root@targeta: | ||
</ | </ | ||
+ | |||
+ | Editez ensuite le fichier **/ | ||
< | < | ||
+ | root@targeta: | ||
+ | root@targeta: | ||
+ | 127.0.0.1 | ||
+ | 10.0.2.110 | ||
+ | 10.0.2.111 | ||
+ | 10.0.2.52 | ||
+ | 10.0.2.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: | ||
- | </code> | + | 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.2.52 closed. | ||
</ | </ | ||
+ | |||
+ | Utilisez la commande **knife bootstrap** pour référencer le client avec le Chef Infra Server : | ||
< | < | ||
+ | root@workstation: | ||
+ | Connecting to 10.0.2.52 | ||
+ | The authenticity of host ' | ||
+ | fingerprint is SHA256: | ||
+ | Are you sure you want to continue connecting | ||
+ | ? (Y/N) Y | ||
+ | Connecting to 10.0.2.52 | ||
+ | Creating new client for web02 | ||
+ | Creating new node for web02 | ||
+ | Bootstrapping 10.0.2.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 | ||
+ | | ||
+ | | ||
+ | | ||
+ | to file / | ||
+ | ... | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
- | < | + | 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.2.53' | ||
+ | Last login: Sun Mar 21 08:53:18 2021 from 10.0.2.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 / | ||
- | </code> | + | [root@targetb ~]# cat /etc/ |
+ | # | ||
- | < | + | # This is the sshd server system-wide configuration file. See |
+ | # sshd_config(5) for more information. | ||
- | </code> | + | # This sshd was compiled with PATH=/usr/ |
- | < | + | # 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.2.110 | ||
+ | 10.0.2.111 | ||
+ | 10.0.2.52 | ||
+ | 10.0.2.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 maintenant 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.2.53 | ||
+ | The authenticity of host ' | ||
+ | fingerprint is SHA256: | ||
+ | Are you sure you want to continue connecting | ||
+ | ? (Y/N) Y | ||
+ | Connecting to 10.0.2.53 | ||
+ | Creating new client for web03 | ||
+ | Creating new node for web03 | ||
+ | Bootstrapping 10.0.2.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 | ||
+ | | ||
+ | | ||
+ | | ||
+ | to file / | ||
+ | ... | ||
+ | Chef Infra Client finished, 0/0 resources updated in 03 seconds | ||
+ | [2023-11-03T16: | ||
</ | </ | ||
- | < | + | ====3.4 - Configuration des Environnements==== |
- | </code> | + | Editez le fichier **/etc/hosts** de votre VM **workstation.ittraining.loc** : |
< | < | ||
+ | root@workstation: | ||
+ | root@workstation: | ||
+ | 127.0.0.1 | ||
+ | 127.0.1.1 | ||
+ | 10.0.2.110 | ||
+ | 10.0.2.111 | ||
+ | 10.0.2.112 | ||
+ | 10.0.2.52 | ||
+ | 10.0.2.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' |
- | < | + | {{ : |
- | </ | + | Cliquez sur l' |
- | < | + | {{ : |
- | </ | + | Cliquez sur la ligne **nginx** : |
- | < | + | {{ : |
- | </code> | + | <WRAP center round important 50%> |
+ | **Important** - Notez les deux versions présentes - **0.1.1** et **0.1.0** | ||
+ | </WRAP> | ||
- | < | + | Cliquez sur **Environments** dans le menu de gauche : |
- | </ | + | {{ : |
- | < | + | Cliquez sur **Create** dans le menu de gauche et renseignez la création de l' |
- | </ | + | {{ : |
- | < | + | Vous obtiendrez : |
- | </ | + | {{ : |
- | < | + | Répétez le processus pour créer l' |
- | </ | + | {{ : |
- | < | + | Vous obtiendrez : |
- | </ | + | {{ : |
- | < | + | Cliquez sur la ligne **Dev** puis sur le lien **Edit** dans le panneau **Cookbook Constraints** Renseignez une contrainte afin que l' |
- | </ | + | {{ : |
- | < | + | Cliquez sur le bouton **Add** puis sur le bouton **Save Constraints** : |
- | </ | + | {{ : |
- | < | + | Répétez le processus pour créer une contrainte pour l' |
- | </ | + | {{ : |
- | < | + | Cliquez sur l' |
- | </ | + | {{ : |
- | < | + | Cliquez sur la ligne **web02** et modifiez l' |
- | </ | + | {{ : |
- | < | + | Cliquez sur la ligne **web03** et modifiez l' |
- | </ | + | {{ : |
- | < | + | Cliquez sur la roue dentée à dans la ligne **web03** puis cliquez sur le lien **Edit Run List**. Dans la fenêtre qui apparait, faites glisser **nginx** de **Available Recipes** vers **Current Run List**. Cliquez ensuite sur le bouton **Save Run List** : |
- | </ | + | {{ : |
- | < | + | Utilisez le même processus pour affecter **nginx** à la **Current Run List** de **web02** : |
- | </ | + | {{ : |
- | < | + | Cliquez sur la ligne **web03** et vérifiez que la **Run List** contient **nginx** versions **0.1.0** : |
- | </ | + | {{ : |
- | < | + | Cliquez sur la ligne **web02** et vérifiez que la **Run List** contient **nginx** versions **0.1.1** : |
- | </ | + | {{ : |
- | < | + | ====3.5 - Exécution avec Environnements==== |
- | </ | + | Connectez-vous à la VM **web02.i2tch.loc** et devenez l' |
< | < | ||
+ | root@web02: | ||
+ | Starting Chef Infra Client, version 15.17.4 | ||
+ | resolving cookbooks for run list: [" | ||
+ | Synchronizing Cookbooks: | ||
+ | - nginx (0.1.1) | ||
+ | Installing Cookbook Gems: | ||
+ | Compiling Cookbooks... | ||
+ | Converging 3 resources | ||
+ | Recipe: nginx:: | ||
+ | * apt_package[nginx] action install | ||
+ | - install version 1.10.3-1+deb9u4 of package nginx | ||
+ | * service[nginx] action enable (up to date) | ||
+ | * service[nginx] action start (up to date) | ||
+ | * cookbook_file[/ | ||
+ | - create new file / | ||
+ | - update content in file / | ||
+ | --- / | ||
+ | +++ / | ||
+ | @@ -1 +1,10 @@ | ||
+ | +< | ||
+ | + < | ||
+ | + < | ||
+ | + </ | ||
+ | + < | ||
+ | + < | ||
+ | + < | ||
+ | + </ | ||
+ | +</ | ||
+ | - change mode from '' | ||
+ | Running handlers: | ||
+ | Running handlers complete | ||
+ | Chef Infra Client finished, 2/4 resources updated in 19 seconds | ||
+ | [2023-11-04T13: | ||
</ | </ | ||
- | <code> | + | <WRAP center round important 50%> |
+ | **Important** - Notez la sortie **Synchronizing Cookbooks: | ||
+ | </WRAP> | ||
- | </code> | + | Vérifiez le contenu du fichier **/var/ |
< | < | ||
+ | root@web02: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
- | <code> | + | <WRAP center round important 50%> |
+ | **Important** - Notez que vous êtes dans l' | ||
+ | </WRAP> | ||
- | </ | + | Connectez-vous à la VM **web03.i2tch.loc** et devenez l' |
< | < | ||
+ | [root@web03 ~]# chef-client | ||
+ | Starting Chef Infra Client, version 15.17.4 | ||
+ | resolving cookbooks for run list: [" | ||
+ | Synchronizing Cookbooks: | ||
+ | - nginx (0.1.0) | ||
+ | Installing Cookbook Gems: | ||
+ | Compiling Cookbooks... | ||
+ | Converging 3 resources | ||
+ | Recipe: nginx:: | ||
+ | * yum_package[nginx] action install (up to date) | ||
+ | * service[nginx] action enable (up to date) | ||
+ | * service[nginx] action start (up to date) | ||
+ | * cookbook_file[/ | ||
+ | - update content in file / | ||
+ | --- / | ||
+ | +++ / | ||
+ | @@ -4,7 +4,7 @@ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | - < | ||
+ | + < | ||
+ | </ | ||
+ | </ | ||
+ | - restore selinux security context | ||
+ | Running handlers: | ||
+ | Running handlers complete | ||
+ | Chef Infra Client finished, 1/4 resources updated in 04 seconds | ||
+ | [2023-11-04T12: | ||
</ | </ | ||
- | <code> | + | <WRAP center round important 50%> |
+ | **Important** - Notez la sortie **Synchronizing Cookbooks: | ||
+ | </WRAP> | ||
- | </code> | + | Vérifiez le contenu du fichier **/var/ |
< | < | ||
+ | [root@web03 ~]# cat / | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
- | <code> | + | <WRAP center round important 50%> |
+ | **Important** - Notez que vous êtes dans l' | ||
+ | </WRAP> | ||
- | </ | ||
----- | ----- | ||
Copyright © 2023 Hugh Norris. | Copyright © 2023 Hugh Norris. |