Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:debian:6:avance:l129:part5 [2019/11/14 06:09] adminelearning:workbooks:debian:6:avance:l129:part5 [2022/06/22 11:51] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
 +
 +Version : **2022.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======DOF505 - Puppet en mode Agent/Maître======+======DOF405 - Puppet en mode Agent/Maître======
  
-=====LAB #27 - Installer Puppet en mode Agent/Maître=====+=====Contenu du Module=====
  
-====Importation de vos Machines Virtuelles====+  * **DOF405 - Puppet en mode Agent/Maître** 
 +    * Contenu du Module 
 +    * Préparation 
 +      * Configuration du Fuseau d'Horaire 
 +      * Désactiver SELinux dans puppetslave02 
 +    * LAB #1 - Configurer Puppet Server 
 +      * Installer puppetserver 
 +      * Configurer puppetserver 
 +    * LAB #2 - Installer et Configurer puppet-agent sur les Machines Virtuelles Esclaves 
 +      * Installer puppet-agent 
 +      * Configurer puppet-agent 
 +    * LAB #3 - Création d'un Utilisateur 
 +    * LAB #4 - Configuration de ssh 
 +    * LAB #5 - Configuration d'IP Tables 
 +      * Exécuter l'Agent Puppet sur slave01.i2tch.loc 
 +      * Exécuter l'Agent Puppet sur slave02.i2tch.loc 
 +    * LAB #6 - Déployer Apache avec Puppet en mode Agent/Maître 
 +      * Création du Rôle 
 +      * Création des Manifests 
 +      * Création des Fichiers de Configuration 
 +      * Création des Templates 
 +      * Déployer Apache
  
-Arrêtez la machine virtuelle vagrant. **Après** avoir fait le test **Validation des Acquis**, ouvrez VirtualBox et importez les machines virtuelles **PuppetMaster**, **PuppetSlave01** et **PuppetSlave02**. :+=====Préparation=====
  
-  Fichier > Importer un appareil virtuel ... +Les trois machines virtuelles **PuppetMaster**, **PuppetSlave01** et **PuppetSlave02** ont été configurées selon le tableau ci-dessous :
- +
-Les trois machines virtuelles sont dans un réseau NAT appelé **NatNetwork**. S'il n'existe pascréez-le :+
  
 ^ Machine ^ Nom d'hôte ^ Adresse IP ^  OS  ^  RAM  ^ ^ Machine ^ Nom d'hôte ^ Adresse IP ^  OS  ^  RAM  ^
-| PuppetMaster | master.i2tch.loc | 10.0.2.| Ubuntu 18.04 | 4Go +| PuppetMaster | master.i2tch.loc | 10.0.2.59 | Ubuntu 18.04 | 4096 Mo 
-| PuppetSlave01 | slave01.i2tch.loc | 10.0.2.| Ubuntu 18.04 | 1Go +| PuppetSlave01 | slave01.i2tch.loc | 10.0.2.68 | Ubuntu 18.04 | 2048 Mo 
-| PuppetSlave02 | slave02.i2tch.loc | 10.0.2.| CentOS 7 | 1Go |+| PuppetSlave02 | slave02.i2tch.loc | 10.0.2.69 | CentOS 7 | 1024 Mo |
  
 Les noms d'utilisateurs et les mots de passe sont identiques pour chaque machine : Les noms d'utilisateurs et les mots de passe sont identiques pour chaque machine :
Ligne 26: Ligne 47:
 | root | fenestros | | root | fenestros |
  
-Créez les redirections de ports dans le réseau NAT **NatNetwork** de VirtualBox (Fichier > Paramètres > Réseau > NatNetwork > Redirection de ports) selon le tableau suivant : +====Configuration du Fuseau d'Horaire====
- +
-^ Nom ^ Protocole ^ IP hôte ^ Port hôte ^ IP invité ^ Port invité ^ +
-| ssh01 | TCP | 127.0.0.1 | 2422 | 10.0.2.4 | 22 | +
-| ssh02 | TCP | 127.0.0.1 | 2522 | 10.0.2.5 | 22 | +
-| ssh03 | TCP | 127.0.0.1 | 2622 | 10.0.2.6 | 22 | +
- +
- +
-====Connexion à vos Machines Virtuelles==== +
- +
-Vous devez vous connecter aux machines virtuelles de la façon suivante : +
- +
-===MAC et Linux=== +
- +
-Ouvrez un terminal et tapez la commande suivante pour la machine **PuppetMaster** : +
- +
-<code> +
-$ ssh -l trainee localhost -p 2422 +
-</code> +
- +
-Ouvrez un autre terminal et tapez la commande suivante pour la machine **PuppetSlave01** : +
- +
-<code> +
-$ ssh -l trainee localhost -p 2522 +
-</code> +
- +
-Ouvrez un autre terminal et tapez la commande suivante pour la machine **PuppetSlave02** : +
- +
-<code> +
-$ ssh -l trainee localhost -p 2622 +
-</code> +
- +
- +
-===Windows=== +
- +
-Ouvrez un autre terminal et tapez la commande suivante pour la machine **PuppetMaster** : +
- +
-  * Host Name --> localhost +
-  * Port --> 2422 +
-  +
-Ouvrez un autre terminal et tapez la commande suivante pour la machine **PuppetSlave01** : +
- +
-  * Host Name --> localhost +
-  * Port --> 2522 +
- +
-Ouvrez un autre terminal et tapez la commande suivante pour la machine **PuppetSlave02** : +
- +
-  * Host Name --> localhost +
-  * Port --> 2622 +
- +
-====Puppet en mode Agent/Maître==== +
- +
-===Préparation===+
  
 Configurez les trois machines virtuelles pour qu'elles soient sur le même fuseau d'horaire : Configurez les trois machines virtuelles pour qu'elles soient sur le même fuseau d'horaire :
Ligne 88: Ligne 57:
  
 Current default time zone: 'Europe/Paris' Current default time zone: 'Europe/Paris'
-Local time is now:      Wed Mar 13 14:31:18 CET 2019+Local time is now:      Wed Feb 12 14:11:40 CET 2020
-Universal Time is now:  Wed Mar 13 13:31:18 UTC 2019.+Universal Time is now:  Wed Feb 12 13:11:40 UTC 2020.
 </code> </code>
  
Ligne 98: Ligne 67:
  
 Current default time zone: 'Europe/Paris' Current default time zone: 'Europe/Paris'
-Local time is now:      Wed Mar 13 14:31:45 CET 2019+Local time is now:      Wed Feb 12 14:12:21 CET 2020
-Universal Time is now:  Wed Mar 13 13:31:45 UTC 2019.+Universal Time is now:  Wed Feb 12 13:12:21 UTC 2020.
 </code> </code>
  
 <code> <code>
 +[trainee@slave02 ~]$ su -
 +Mot de passe : fenestros
 +Dernière connexion : mercredi 13 mars 2019 à 12:55:24 CET sur tty1
 [root@slave02 ~]# timedatectl set-timezone 'Europe/Paris' [root@slave02 ~]# timedatectl set-timezone 'Europe/Paris'
 [root@slave02 ~]# date [root@slave02 ~]# date
-Wed 13 Mar 14:34:03 CET 2019+Wed 12 Feb 14:12:51 CET 2020
 </code> </code>
  
-===Installer puppetserver===+====Désactiver SELinux dans puppetslave02==== 
 + 
 +<code> 
 +[root@slave02 ~]# vi /etc/sysconfig/selinux  
 +[root@slave02 ~]# cat /etc/sysconfig/selinux  
 + 
 +# This file controls the state of SELinux on the system. 
 +# SELINUX= can take one of these three values: 
 +#     enforcing - SELinux security policy is enforced. 
 +#     permissive - SELinux prints warnings instead of enforcing. 
 +#     disabled - No SELinux policy is loaded. 
 +SELINUX=permissive 
 +# SELINUXTYPE= can take one of three two values: 
 +#     targeted - Targeted processes are protected, 
 +#     minimum - Modification of targeted policy. Only selected processes are protected.  
 +#     mls - Multi Level Security protection. 
 +SELINUXTYPE=targeted  
 + 
 + 
 +[root@slave02 ~]# setenforce permissive 
 +</code> 
 + 
 +=====LAB #1 - Installer et Configurer Puppet Server===== 
 + 
 +====Installer puppetserver====
  
 Installez Puppet dans la machine virtuelle **PuppetMaster** : Installez Puppet dans la machine virtuelle **PuppetMaster** :
Ligne 114: Ligne 110:
 <code> <code>
 root@master:~# wget https://apt.puppetlabs.com/puppet-release-bionic.deb root@master:~# wget https://apt.puppetlabs.com/puppet-release-bionic.deb
---2019-03-13 14:35:40--  https://apt.puppetlabs.com/puppet-release-bionic.deb +--2020-02-12 14:13:20--  https://apt.puppetlabs.com/puppet-release-bionic.deb 
-Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 13.32.210.13, 13.32.210.105, 13.32.210.97, ... +Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 13.225.38.129, 13.225.38.76, 13.225.38.45, ... 
-Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|13.32.210.13|:443... connected.+Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|13.225.38.129|:443... connected.
 HTTP request sent, awaiting response... 200 OK HTTP request sent, awaiting response... 200 OK
-Length: 9672 (9.4K) [application/x-debian-package]+Length: 11724 (11K) [application/x-debian-package]
 Saving to: ‘puppet-release-bionic.deb’ Saving to: ‘puppet-release-bionic.deb’
  
-puppet-release-bion 100%[===================>  9.45K  --.-KB/   in 0s      +puppet-release-bionic.deb       100%[=====================================================> 11.45K  --.-KB/   in 0s      
  
-2019-03-13 14:35:40 (78.9 MB/s) - ‘puppet-release-bionic.deb’ saved [9672/9672]+2020-02-12 14:13:21 (346 MB/s) - ‘puppet-release-bionic.deb’ saved [11724/11724]
  
 root@master:~# dpkg -i puppet-release-bionic.deb root@master:~# dpkg -i puppet-release-bionic.deb
Ligne 129: Ligne 125:
 (Reading database ... 128539 files and directories currently installed.) (Reading database ... 128539 files and directories currently installed.)
 Preparing to unpack puppet-release-bionic.deb ... Preparing to unpack puppet-release-bionic.deb ...
-Unpacking puppet-release (1.0.0-3bionic) ... +Unpacking puppet-release (1.0.0-7bionic) ... 
-Setting up puppet-release (1.0.0-3bionic) ...+Setting up puppet-release (1.0.0-7bionic) ...
  
 root@master:~# apt update root@master:~# apt update
-Ign:1 http://apt.puppetlabs.com bionic InRelease +Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease 
-Get:2 http://apt.puppetlabs.com bionic Release [54.2 kB] +Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease                              
-Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] +Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease                             
-Hit:4 http://us.archive.ubuntu.com/ubuntu bionic InRelease                      +Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease      
-Get:5 http://apt.puppetlabs.com bionic Release.gpg [819 B]                      +Get:5 http://apt.puppetlabs.com bionic InRelease [85.kB]                
-Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.kB]    +Get:http://apt.puppetlabs.com bionic/puppet amd64 Packages [39.9 kB
-Get:http://apt.puppetlabs.com bionic/puppet all Packages [4,545 B           +Get:http://apt.puppetlabs.com bionic/puppet i386 Packages [16.kB
-Get:http://apt.puppetlabs.com bionic/puppet i386 Packages [4,545 B          +Get:http://apt.puppetlabs.com bionic/puppet all Packages [16.kB] 
-Get:http://apt.puppetlabs.com bionic/puppet amd64 Packages [13.1 kB] +Fetched 158 kB in 2s (83.9 kB/s)
-Get:10 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] +
-Fetched 329 kB in 2s (192 kB/s)     +
 Reading package lists... Done Reading package lists... Done
 Building dependency tree        Building dependency tree       
 Reading state information... Done Reading state information... Done
-474 packages can be upgraded. Run 'apt list --upgradable' to see them.+624 packages can be upgraded. Run 'apt list --upgradable' to see them.
  
 root@master:~# apt install puppetserver root@master:~# apt install puppetserver
Ligne 154: Ligne 148:
 Reading state information... Done Reading state information... Done
 The following additional packages will be installed: The following additional packages will be installed:
-  ca-certificates-java java-common net-tools openjdk-8-jre-headless +  ca-certificates-java java-common net-tools openjdk-8-jre-headless puppet-agent
-  puppet-agent+
 Suggested packages: Suggested packages:
-  default-jre fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho +  default-jre fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei
-  fonts-wqy-microhei fonts-wqy-zenhei+
 The following NEW packages will be installed: The following NEW packages will be installed:
-  ca-certificates-java java-common net-tools openjdk-8-jre-headless +  ca-certificates-java java-common net-tools openjdk-8-jre-headless puppet-agent puppetserver 
-  puppet-agent puppetserver +0 upgraded, 6 newly installed, 0 to remove and 624 not upgraded. 
-0 upgraded, 6 newly installed, 0 to remove and 474 not upgraded. +Need to get 110 MB of archives. 
-Need to get 124 MB of archives. +After this operation, 290 MB of additional disk space will be used.
-After this operation, 301 MB of additional disk space will be used.+
 Do you want to continue? [Y/n] y Do you want to continue? [Y/n] y
 </code> </code>
  
-===Configurer Puppet Server===+====Configurer puppetserver====
  
 Utilisez la commande **puppet config** pour définir la valeur de la variable **dns_alt_names** : Utilisez la commande **puppet config** pour définir la valeur de la variable **dns_alt_names** :
Ligne 213: Ligne 204:
 Synchronizing state of puppetserver.service with SysV service script with /lib/systemd/systemd-sysv-install. Synchronizing state of puppetserver.service with SysV service script with /lib/systemd/systemd-sysv-install.
 Executing: /lib/systemd/systemd-sysv-install enable puppetserver Executing: /lib/systemd/systemd-sysv-install enable puppetserver
 +
 root@master:~# systemctl start puppetserver root@master:~# systemctl start puppetserver
-root@master:~# systemctl status puppetserver+oot@master:~# systemctl status puppetserver.service 
 ● puppetserver.service - puppetserver Service ● puppetserver.service - puppetserver Service
-   Loaded: loaded (/lib/systemd/system/puppetserver.service; enabled; vendor preset: enabled) +   Loaded: loaded (/lib/systemd/system/puppetserver.service; enabled; vendor pre 
-   Active: active (running) since Wed 2019-03-13 14:59:31 CET; 11s ago +   Active: active (running) since Wed 2020-02-12 14:43:22 CET; 8min ago 
-  Process: 742 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS) +  Process: 746 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserv 
- Main PID: 818 (java) + Main PID: 838 (java) 
-    Tasks: 41 (limit: 4915)+    Tasks: 46 (limit: 4915)
    CGroup: /system.slice/puppetserver.service    CGroup: /system.slice/puppetserver.service
-           └─818 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -Djava.security+           └─838 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs
  
-Mar 13 14:57:54 master.i2tch.loc systemd[1]: Starting puppetserver Service... +Feb 12 14:42:34 master.i2tch.loc systemd[1]: Starting puppetserver Service... 
-Mar 13 14:59:31 master.i2tch.loc systemd[1]: Started puppetserver Service. +Feb 12 14:43:22 master.i2tch.loc systemd[1]: Started puppetserver Service.
-lines 1-11/11 (END)+
 </code> </code>
  
-===Installer puppet-agent sur les Machines Virtuelles Esclaves===+Dernièrement, vérifiez que le fichier **/etc/hosts** contient des entrées pour **master.i2tch.loc**, **slave01.i2tch.loc** et **slave02.i2tch.loc** : 
 + 
 +<code> 
 +root@master:~# vi /etc/hosts 
 +root@master:~# cat /etc/hosts 
 +127.0.0.1       localhost 
 +127.0.1.1       master.i2tch.loc        master    
 +10.0.2.59        master.i2tch.loc  master   
 +10.0.2.68        slave01.i2tch.loc       slave01 
 +10.0.2.69        slave02.i2tch.loc       slave02 
 + 
 +# The following lines are desirable for IPv6 capable hosts 
 +::1     ip6-localhost ip6-loopback 
 +fe00::0 ip6-localnet 
 +ff00::0 ip6-mcastprefix 
 +ff02::1 ip6-allnodes 
 +ff02::2 ip6-allrouters 
 +</code> 
 + 
 +=====LAB #2 - Installer et Configurer puppet-agent sur les Machines Virtuelles Esclaves===== 
 + 
 +====Installer puppet-agent====
  
 <code> <code>
 root@slave01:~# wget https://apt.puppetlabs.com/puppet-release-bionic.deb root@slave01:~# wget https://apt.puppetlabs.com/puppet-release-bionic.deb
---2019-03-13 15:00:33--  https://apt.puppetlabs.com/puppet-release-bionic.deb +--2020-02-12 14:27:25--  https://apt.puppetlabs.com/puppet-release-bionic.deb 
-Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 13.32.210.1313.32.210.9713.32.210.213, ... +Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 143.204.226.21143.204.226.18143.204.226.112, ... 
-Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|13.32.210.13|:443... connected.+Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|143.204.226.21|:443... connected.
 HTTP request sent, awaiting response... 200 OK HTTP request sent, awaiting response... 200 OK
-Length: 9672 (9.4K) [application/x-debian-package]+Length: 11724 (11K) [application/x-debian-package]
 Saving to: ‘puppet-release-bionic.deb’ Saving to: ‘puppet-release-bionic.deb’
  
-puppet-release-bionic.deb       100%[=====================================================>  9.45K  --.-KB/   in 0s      +puppet-release-bionic.deb       100%[=====================================================> 11.45K  --.-KB/   in 0s      
  
-2019-03-13 15:00:33 (114 MB/s) - ‘puppet-release-bionic.deb’ saved [9672/9672]+2020-02-12 14:27:26 (97.4 MB/s) - ‘puppet-release-bionic.deb’ saved [11724/11724]
  
 root@slave01:~# dpkg -i puppet-release-bionic.deb root@slave01:~# dpkg -i puppet-release-bionic.deb
Ligne 248: Ligne 260:
 (Reading database ... 128539 files and directories currently installed.) (Reading database ... 128539 files and directories currently installed.)
 Preparing to unpack puppet-release-bionic.deb ... Preparing to unpack puppet-release-bionic.deb ...
-Unpacking puppet-release (1.0.0-3bionic) ... +Unpacking puppet-release (1.0.0-7bionic) ... 
-Setting up puppet-release (1.0.0-3bionic) ... +Setting up puppet-release (1.0.0-7bionic) ... 
-root@slave01:~# +
 root@slave01:~# apt update root@slave01:~# apt update
-Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] +Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease    
-Ign:2 http://apt.puppetlabs.com bionic InRelease                            +Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease           
-Get:3 http://apt.puppetlabs.com bionic Release [54.kB]                    +Get:3 http://apt.puppetlabs.com bionic InRelease [85.kB]                
-Hit:4 http://us.archive.ubuntu.com/ubuntu bionic InRelease                               +Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease                    
-Get:5 http://apt.puppetlabs.com bionic Release.gpg [819 B]                          +Hit:5 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease                  
-Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] +Get:http://apt.puppetlabs.com bionic/puppet i386 Packages [16.kB
-Get:http://apt.puppetlabs.com bionic/puppet all Packages [4,545 B+Get:http://apt.puppetlabs.com bionic/puppet amd64 Packages [39.kB] 
-Get:http://apt.puppetlabs.com bionic/puppet amd64 Packages [13.kB]            +Get:http://apt.puppetlabs.com bionic/puppet all Packages [16.4 kB] 
-Get:http://apt.puppetlabs.com bionic/puppet i386 Packages [4,545 B]             +Fetched 158 kB in 2s (81.3 kB/s)      
-Get:10 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] +
-Get:11 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [472 kB] +
-Get:12 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [552 kB] +
-Get:13 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [741 kB] +
-Get:14 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [731 kB] +
-Fetched 2,826 kB in 5s (568 kB/s)                      +
 Reading package lists... Done Reading package lists... Done
 Building dependency tree        Building dependency tree       
 Reading state information... Done Reading state information... Done
-474 packages can be upgraded. Run 'apt list --upgradable' to see them. +619 packages can be upgraded. Run 'apt list --upgradable' to see them. 
-root@slave01:~# +
 root@slave01:~# apt install puppet-agent root@slave01:~# apt install puppet-agent
 Reading package lists... Done Reading package lists... Done
Ligne 278: Ligne 284:
 The following NEW packages will be installed: The following NEW packages will be installed:
   puppet-agent   puppet-agent
-0 upgraded, 1 newly installed, 0 to remove and 474 not upgraded. +0 upgraded, 1 newly installed, 0 to remove and 619 not upgraded. 
-Need to get 18.MB of archives. +Need to get 20.MB of archives. 
-After this operation, 110 MB of additional disk space will be used. +After this operation, 116 MB of additional disk space will be used. 
-Get:1 http://apt.puppetlabs.com bionic/puppet amd64 puppet-agent amd64 6.3.0-1bionic [18.MB] +Get:1 http://apt.puppetlabs.com bionic/puppet amd64 puppet-agent amd64 6.12.0-1bionic [20.MB] 
-Fetched 18.MB in 6s (3,051 kB/s)                                                                                           +Fetched 20.MB in 3s (6,846 kB/s)       
 Selecting previously unselected package puppet-agent. Selecting previously unselected package puppet-agent.
 (Reading database ... 128544 files and directories currently installed.) (Reading database ... 128544 files and directories currently installed.)
-Preparing to unpack .../puppet-agent_6.3.0-1bionic_amd64.deb ... +Preparing to unpack .../puppet-agent_6.12.0-1bionic_amd64.deb ... 
-Unpacking puppet-agent (6.3.0-1bionic) ... +Unpacking puppet-agent (6.12.0-1bionic) ... 
-Setting up puppet-agent (6.3.0-1bionic) ...+Setting up puppet-agent (6.12.0-1bionic) ...
 Created symlink /etc/systemd/system/multi-user.target.wants/puppet.service → /lib/systemd/system/puppet.service. Created symlink /etc/systemd/system/multi-user.target.wants/puppet.service → /lib/systemd/system/puppet.service.
 Created symlink /etc/systemd/system/multi-user.target.wants/pxp-agent.service → /lib/systemd/system/pxp-agent.service. Created symlink /etc/systemd/system/multi-user.target.wants/pxp-agent.service → /lib/systemd/system/pxp-agent.service.
Ligne 297: Ligne 303:
 [root@slave02 ~]# rpm -Uvh https://yum.puppet.com/puppet/puppet-release-el-7.noarch.rpm [root@slave02 ~]# rpm -Uvh https://yum.puppet.com/puppet/puppet-release-el-7.noarch.rpm
 Retrieving https://yum.puppet.com/puppet/puppet-release-el-7.noarch.rpm Retrieving https://yum.puppet.com/puppet/puppet-release-el-7.noarch.rpm
-warning: /var/tmp/rpm-tmp.vNPfWO: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY+warning: /var/tmp/rpm-tmp.PYL8Aj: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY
 Preparing...                          ################################# [100%] Preparing...                          ################################# [100%]
 Updating / installing... Updating / installing...
    1:puppet-release-1.0.0-3.el7       ################################# [100%]    1:puppet-release-1.0.0-3.el7       ################################# [100%]
-[root@slave02 ~]# +
 [root@slave02 ~]# yum install puppet-agent [root@slave02 ~]# yum install puppet-agent
 Loaded plugins: fastestmirror, langpacks Loaded plugins: fastestmirror, langpacks
 Determining fastest mirrors Determining fastest mirrors
- * base: rep-centos-fr.upress.io + * base: mirrors.ircam.fr 
- * extras: mirrors.atosworldline.com + * extras: miroir.univ-lorraine.fr 
- * updates: rep-centos-fr.upress.io+ * updates: mirrors.standaloneinstaller.com
 base                                                                                                   | 3.6 kB  00:00:00      base                                                                                                   | 3.6 kB  00:00:00     
-extras                                                                                                 3.kB  00:00:00     +extras                                                                                                 2.kB  00:00:00     
 puppet                                                                                                 | 2.5 kB  00:00:00      puppet                                                                                                 | 2.5 kB  00:00:00     
-updates                                                                                                | 3.kB  00:00:00      +updates                                                                                                | 2.kB  00:00:00      
-(1/3): extras/7/x86_64/primary_db                                                                      | 180 kB  00:00:00      +(1/5): base/7/x86_64/group_gz                                                                          | 165 kB  00:00:00      
-(2/3): puppet/x86_64/primary_db                                                                        |  83 kB  00:00:00      +(2/5): extras/7/x86_64/primary_db                                                                      | 159 kB  00:00:00      
-(3/3): updates/7/x86_64/primary_db                                                                     2.MB  00:00:01     +(3/5): puppet/x86_64/primary_db                                                                        | 256 kB  00:00:02      
 +(4/5): base/7/x86_64/primary_db                                                                        | 6.0 MB  00:00:02      
 +(5/5): updates/7/x86_64/primary_db                                                                     6.MB  00:00:02     
 Resolving Dependencies Resolving Dependencies
 --> Running transaction check --> Running transaction check
----> Package puppet-agent.x86_64 0:6.3.0-1.el7 will be installed+---> Package puppet-agent.x86_64 0:6.12.0-1.el7 will be installed
 --> Finished Dependency Resolution --> Finished Dependency Resolution
  
Ligne 323: Ligne 331:
  
 ============================================================================================================================== ==============================================================================================================================
- Package                          Arch                       Version                         Repository                  Size+ Package                         Arch                      Version                            Repository                 Size
 ============================================================================================================================== ==============================================================================================================================
 Installing: Installing:
- puppet-agent                     x86_64                     6.3.0-1.el7                     puppet                      22 M+ puppet-agent                    x86_64                    6.12.0-1.el7                       puppet                     23 M
  
 Transaction Summary Transaction Summary
Ligne 332: Ligne 340:
 Install  1 Package Install  1 Package
  
-Total download size: 22 +Total download size: 23 
-Installed size: 22 M+Installed size: 23 M
 Is this ok [y/d/N]: y Is this ok [y/d/N]: y
 </code> </code>
  
-===Configurer puppet-agent sur les Machines Virtuelles Esclaves===+====Configurer puppet-agent====
  
-Utilisez la commande **puppet config** sur chaque noeud pour définir la valeur de la variable **server** :+Utilisez la commande **puppet config** sur chaque nœud pour définir la valeur de la variable **server** :
  
 <code> <code>
Ligne 378: Ligne 386:
 root@master:~# /opt/puppetlabs/bin/puppetserver ca list root@master:~# /opt/puppetlabs/bin/puppetserver ca list
 Requested Certificates: Requested Certificates:
-    slave01.i2tch.loc   (SHA256)  D0:69:5E:6D:90:D2:5A:44:96:50:AB:30:F7:26:2C:B1:2D:BE:EB:79:AF:D8:1F:9E:6B:ED:34:CF:3E:46:AC:1C +    slave01.i2tch.loc   (SHA256)  81:02:B3:C7:6F:BE:DB:48:93:9E:1A:A5:87:CA:AF:E5:DB:14:09:11:2D:43:60:39:1C:BE:6F:A1:CF:C0:BD:31 
-    slave02.i2tch.loc   (SHA256)  2C:E9:74:75:F2:3C:1C:DC:68:76:FF:70:31:B2:62:BF:39:B0:82:5D:07:52:74:E3:F3:B4:B7:4B:F3:5A:0B:85+    slave02.i2tch.loc   (SHA256)  EF:BF:00:84:F1:F0:3B:C0:5F:A8:6F:49:98:E5:73:FA:39:B6:16:8E:8D:B3:0E:38:04:76:4D:2E:BF:BE:53:57
 </code> </code>
  
 Validez les certificats en attente : Validez les certificats en attente :
 +
 +<code>
 +root@master:~# /opt/puppetlabs/bin/puppetserver ca sign --certname slave01.i2tch.loc,slave02.i2tch.loc
 +Successfully signed certificate request for slave01.i2tch.loc
 +Successfully signed certificate request for slave02.i2tch.loc
 +</code>
 +
 +Si vous ne voyez pas de certificats ou seulement un certificat sur deux, arrêtez le service puppet sur le(s) noeud(s) concerné(s) :
 +
 +<code>
 +root@slave01:~# systemctl stop puppet
 +root@slave02:~# systemctl stop puppet
 +</code>
 +
 +Supprimez les certificats existants :
 +
 +<code>
 +root@master:~# puppetserver ca clean --certname slave01.i2tch.loc
 +root@master:~# puppetserver ca clean --certname slave02.i2tch.loc
 +</code>
 +
 +Lancez ensuite les commandes suivantes dans les deux esclaves :
 +
 +<code>
 +root@slave01:~# rm -rf /etc/puppetlabs/puppet/ssl/
 +root@slave01:~# puppet agent --test
 +Info: Creating a new RSA SSL key for slave01.i2tch.loc
 +Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
 +Info: Creating a new SSL certificate request for slave01.i2tch.loc
 +Info: Certificate Request fingerprint (SHA256): 81:02:B3:C7:6F:BE:DB:48:93:9E:1A:A5:87:CA:AF:E5:DB:14:09:11:2D:43:60:39:1C:BE:6F:A1:CF:C0:BD:31
 +Info: Certificate for slave01.i2tch.loc has not been signed yet
 +Couldn't fetch certificate from CA server; you might still need to sign this agent's certificate (slave01.i2tch.loc).
 +Exiting now because the waitforcert setting is set to 0.
 +</code>
 +
 +<code>
 +[root@slave02 ~]# rm -rf /etc/puppetlabs/puppet/ssl/
 +[root@slave02 ~]# puppet agent --test
 +Info: Creating a new RSA SSL key for slave02.i2tch.loc
 +Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
 +Info: Creating a new SSL certificate request for slave02.i2tch.loc
 +Info: Certificate Request fingerprint (SHA256): EF:BF:00:84:F1:F0:3B:C0:5F:A8:6F:49:98:E5:73:FA:39:B6:16:8E:8D:B3:0E:38:04:76:4D:2E:BF:BE:53:57
 +Info: Certificate for slave02.i2tch.loc has not been signed yet
 +Couldn't fetch certificate from CA server; you might still need to sign this agent's certificate (slave02.i2tch.loc).
 +Exiting now because the waitforcert setting is set to 0.
 +</code>
 +
 +Retournez ensuite à la machine virtuelle **master** et validez les certificats en attente :
  
 <code> <code>
Ligne 394: Ligne 450:
 <code> <code>
 root@slave01:~# /opt/puppetlabs/bin/puppet agent -t root@slave01:~# /opt/puppetlabs/bin/puppet agent -t
 +Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
 +Info: Creating a new SSL certificate request for slave01.i2tch.loc
 +Info: Certificate Request fingerprint (SHA256): 81:02:B3:C7:6F:BE:DB:48:93:9E:1A:A5:87:CA:AF:E5:DB:14:09:11:2D:43:60:39:1C:BE:6F:A1:CF:C0:BD:31
 +Info: Downloaded certificate for slave01.i2tch.loc from https://master.i2tch.loc:8140/puppet-ca/v1
 Info: Using configured environment 'production' Info: Using configured environment 'production'
 Info: Retrieving pluginfacts Info: Retrieving pluginfacts
Ligne 399: Ligne 459:
 Info: Retrieving locales Info: Retrieving locales
 Info: Caching catalog for slave01.i2tch.loc Info: Caching catalog for slave01.i2tch.loc
-Info: Applying configuration version '1552488579+Info: Applying configuration version '1581520502
-Notice: Applied catalog in 0.02 seconds+Notice: Applied catalog in 0.01 seconds
 </code> </code>
  
Ligne 410: Ligne 470:
 Info: Retrieving locales Info: Retrieving locales
 Info: Caching catalog for slave02.i2tch.loc Info: Caching catalog for slave02.i2tch.loc
-Info: Applying configuration version '1552488587+Info: Applying configuration version '1581520616
-Notice: Applied catalog in 0.01 seconds+Notice: Applied catalog in 0.03 seconds
 </code> </code>
  
-===Sécuriser l'Installation=== +=====LAB #3 - Création d'un Utilisateur=====
- +
-==Création d'un Utilisateur==+
  
 Placez-vous dans le répertoire **/etc/puppetlabs/code/environments/production/modules/** et créez le répertoire **accounts** : Placez-vous dans le répertoire **/etc/puppetlabs/code/environments/production/modules/** et créez le répertoire **accounts** :
Ligne 429: Ligne 487:
 <code> <code>
 root@master:/etc/puppetlabs/code/environments/production/modules# cd accounts root@master:/etc/puppetlabs/code/environments/production/modules# cd accounts
 +
 +SNAPSHOT1
 +
 root@master:/etc/puppetlabs/code/environments/production/modules/accounts# mkdir {examples,files,manifests,templates} root@master:/etc/puppetlabs/code/environments/production/modules/accounts# mkdir {examples,files,manifests,templates}
 </code> </code>
Ligne 437: Ligne 498:
 root@master:/etc/puppetlabs/code/environments/production/modules/accounts# cd manifests root@master:/etc/puppetlabs/code/environments/production/modules/accounts# cd manifests
 root@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests# vi init.pp root@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests# vi init.pp
-root@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests# cat  init.pp+root@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests# cat init.pp
 class accounts { class accounts {
  
Ligne 480: Ligne 541:
 Password: toto Password: toto
 Verifying - Password: toto Verifying - Password: toto
-$1$WvExmQIP$bg4DwtAR2AMORYaP5iTsI/ +$1$1lyYx3kO$sb0z34V28E7b7kYQb3Wjz.
-root@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests# +
 </code> </code>
  
Ligne 506: Ligne 566:
     gid         => 'toto',     gid         => 'toto',
     groups      => "$rootgroup",     groups      => "$rootgroup",
-    password    => '$1$WvExmQIP$bg4DwtAR2AMORYaP5iTsI/',+    password    => '$1$1lyYx3kO$sb0z34V28E7b7kYQb3Wjz.',
   }   }
  
Ligne 536: Ligne 596:
 <code> <code>
 root@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples# /opt/puppetlabs/bin/puppet apply --noop init.pp root@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples# /opt/puppetlabs/bin/puppet apply --noop init.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.11 seconds+Notice: Compiled catalog for master.i2tch.loc in environment production in 0.10 seconds
 Notice: /Stage[main]/Accounts::Groups/Group[toto]/ensure: current_value 'absent', should be 'present' (noop) Notice: /Stage[main]/Accounts::Groups/Group[toto]/ensure: current_value 'absent', should be 'present' (noop)
 Notice: Class[Accounts::Groups]: Would have triggered 'refresh' from 1 event Notice: Class[Accounts::Groups]: Would have triggered 'refresh' from 1 event
-Notice: /Stage[main]/Accounts/User[username]/ensure: current_value 'absent', should be 'present' (noop)+Notice: /Stage[main]/Accounts/User[toto]/ensure: current_value 'absent', should be 'present' (noop)
 Notice: Class[Accounts]: Would have triggered 'refresh' from 1 event Notice: Class[Accounts]: Would have triggered 'refresh' from 1 event
 Notice: Stage[main]: Would have triggered 'refresh' from 2 events Notice: Stage[main]: Would have triggered 'refresh' from 2 events
-Notice: Applied catalog in 0.08 seconds+Notice: Applied catalog in 0.39 seconds
 </code> </code>
  
Ligne 549: Ligne 609:
 <code> <code>
 root@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples# /opt/puppetlabs/bin/puppet apply init.pp root@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples# /opt/puppetlabs/bin/puppet apply init.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.02 seconds+Notice: Compiled catalog for master.i2tch.loc in environment production in 0.04 seconds
 Notice: /Stage[main]/Accounts::Groups/Group[toto]/ensure: created Notice: /Stage[main]/Accounts::Groups/Group[toto]/ensure: created
-Notice: /Stage[main]/Accounts/User[username]/ensure: created +Notice: /Stage[main]/Accounts/User[toto]/ensure: created 
-Notice: Applied catalog in 0.53 seconds+Notice: Applied catalog in 0.37 seconds
 </code> </code>
  
Ligne 558: Ligne 618:
  
 <code> <code>
 +trainee@traineeXX:~$ ssh -l toto 10.0.2.59
 +toto@localhost's password: toto
 Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64) Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64)
  
Ligne 569: Ligne 631:
      https://ubuntu.com/livepatch      https://ubuntu.com/livepatch
  
-323 packages can be updated. +636 packages can be updated. 
-updates are security updates.+380 updates are security updates.
  
-*** System restart required *** 
  
 The programs included with the Ubuntu system are free software; The programs included with the Ubuntu system are free software;
 the exact distribution terms for each program are described in the the exact distribution terms for each program are described in the
 individual files in /usr/share/doc/*/copyright. individual files in /usr/share/doc/*/copyright.
-de>+
 Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
 applicable law. applicable law.
Ligne 587: Ligne 648:
 </code> </code>
  
-==Configuration de ssh==+=====LAB #4 - Configuration de ssh=====
  
 Naviguez vers le répertoire **/etc/puppetlabs/code/environements/production/modules/accounts/files** :  Naviguez vers le répertoire **/etc/puppetlabs/code/environements/production/modules/accounts/files** : 
Ligne 596: Ligne 657:
 </code> </code>
  
-Copiez le fichier **/etc/sshd_config** ver le répertoire **/etc/puppetlabs/code/environments/production/modules/accounts/files** :+Copiez le fichier **/etc/sshd_config** vers le répertoire **/etc/puppetlabs/code/environments/production/modules/accounts/files** :
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ sudo cp /etc/ssh/sshd_config .+toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ sudo mv /etc/ssh/sshd_config .
 [sudo] password for toto: toto [sudo] password for toto: toto
 </code> </code>
Ligne 607: Ligne 668:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ sudo vi sshd_config  toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ sudo vi sshd_config 
-toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ cat vi sshd_config +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/files$ cat sshd_config 
 ... ...
 # Authentication: # Authentication:
Ligne 633: Ligne 694:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ sudo vi ssh.pp toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ sudo vi ssh.pp
-[sudo] password for toto: toto 
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ cat ssh.pp toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ cat ssh.pp
 class accounts::ssh { class accounts::ssh {
Ligne 679: Ligne 739:
     gid         => 'toto',     gid         => 'toto',
     groups      => "$rootgroup",     groups      => "$rootgroup",
-    password    => '$1$WvExmQIP$bg4DwtAR2AMORYaP5iTsI/',+    password    => '$1$1lyYx3kO$sb0z34V28E7b7kYQb3Wjz.',
   }   }
  
Ligne 685: Ligne 745:
 </code> </code>
  
-Testez ensuite la syntaxe de votre fichier **ssh.pp** :+Testez ensuite la syntaxe des fichiers **ssh.pp** et **init.pp** :
  
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate ssh.pp toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate ssh.pp
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$  toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate init.pp
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ 
 +</code>
 +
 +Naviguez vers le répertoire **/etc/puppetlabs/code/environments/production/modules/accounts** et installez l'utilitaire **tree** :
 +
 +<code>
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/manifests$ cd ..
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts$ sudo apt install tree
 +Reading package lists... Done
 +Building dependency tree       
 +Reading state information... Done
 +The following NEW packages will be installed:
 +  tree
 +0 upgraded, 1 newly installed, 0 to remove and 574 not upgraded.
 +Need to get 40.7 kB of archives.
 +After this operation, 105 kB of additional disk space will be used.
 +Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 tree amd64 1.7.0-5 [40.7 kB]
 +Fetched 40.7 kB in 1s (72.3 kB/s)
 +Selecting previously unselected package tree.
 +(Reading database ... 147924 files and directories currently installed.)
 +Preparing to unpack .../tree_1.7.0-5_amd64.deb ...
 +Unpacking tree (1.7.0-5) ...
 +Setting up tree (1.7.0-5) ...
 +Processing triggers for man-db (2.8.3-2) ...
 +</code>
 +
 +Vérifiez l'arborescence du module **accounts** :
 +
 +<code>
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts$ tree
 +.
 +├── examples
 +│   └── init.pp
 +├── files
 +│   └── sshd_config
 +├── manifests
 +│   ├── groups.pp
 +│   ├── init.pp
 +│   └── ssh.pp
 +└── templates
 +
 +4 directories, 5 files
 +</code>
 +
 +Naviguez vers le répertoire **/etc/puppetlabs/code/environments/production/modules/accounts/examples** :
 +
 +<code>
 +toto@master:/etc/puppetlabs/code/environments/production/modules/accounts$ cd examples/
 </code> </code>
  
Ligne 696: Ligne 805:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ sudo /opt/puppetlabs/bin/puppet apply --noop init.pp toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ sudo /opt/puppetlabs/bin/puppet apply --noop init.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.39 seconds +Notice: Compiled catalog for master.i2tch.loc in environment production in 0.24 seconds 
-Notice: /Stage[main]/Accounts::Ssh/File[/etc/ssh/sshd_config]/content: current_value '{md5}739d6887c8f3dd71a9168c614c07175c', should be '{md5}d1da0b2e3b0f1ac7092fd95333d5e2d4' (noop)+Notice: /Stage[main]/Accounts::Ssh/File[/etc/ssh/sshd_config]/content: current_value '{md5}739d6887c8f3dd71a9168c614c07175c', should be '{md5}0876b6b0db0707db221a5c736d8a896a' (noop)
 Notice: /Stage[main]/Accounts::Ssh/Service[ssh]: Would have triggered 'refresh' from 1 event Notice: /Stage[main]/Accounts::Ssh/Service[ssh]: Would have triggered 'refresh' from 1 event
 Notice: Class[Accounts::Ssh]: Would have triggered 'refresh' from 2 events Notice: Class[Accounts::Ssh]: Would have triggered 'refresh' from 2 events
 Notice: Stage[main]: Would have triggered 'refresh' from 1 event Notice: Stage[main]: Would have triggered 'refresh' from 1 event
-Notice: Applied catalog in 0.11 seconds+Notice: Applied catalog in 0.03 seconds
 </code> </code>
  
Ligne 708: Ligne 817:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ sudo /opt/puppetlabs/bin/puppet apply init.pp toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ sudo /opt/puppetlabs/bin/puppet apply init.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.28 seconds +Notice: Compiled catalog for master.i2tch.loc in environment production in 0.25 seconds 
-Notice: /Stage[main]/Accounts::Ssh/File[/etc/ssh/sshd_config]/content: content changed '{md5}d1da0b2e3b0f1ac7092fd95333d5e2d4' to '{md5}1ddc2551e3c3766390706609083581b2'+Notice: /Stage[main]/Accounts::Ssh/File[/etc/ssh/sshd_config]/content: content changed '{md5}0876b6b0db0707db221a5c736d8a896a' to '{md5}1ddc2551e3c3766390706609083581b2'
 Notice: /Stage[main]/Accounts::Ssh/Service[ssh]: Triggered 'refresh' from 1 event Notice: /Stage[main]/Accounts::Ssh/Service[ssh]: Triggered 'refresh' from 1 event
-Notice: Applied catalog in 0.18 seconds+Notice: Applied catalog in 0.09 seconds
 </code> </code>
  
-==Configuration d'IP Tables==+=====LAB #5 - Configuration d'IP Tables=====
  
 Installez le paquet **iptables-persistent** ou **iptables-services** dans chaque machine virtuelle en fonction de la distribution : Installez le paquet **iptables-persistent** ou **iptables-services** dans chaque machine virtuelle en fonction de la distribution :
Ligne 720: Ligne 829:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ cd ~ toto@master:/etc/puppetlabs/code/environments/production/modules/accounts/examples$ cd ~
-toto@master:~$ sudo apt-get update 
-[sudo] password for toto: toto 
 toto@master:~$ sudo apt install iptables-persistent toto@master:~$ sudo apt install iptables-persistent
 </code> </code>
  
 <code> <code>
-trainee@slave01:~$ su - 
-Password: fenestros 
-root@slave01:~# apt-get update 
 root@slave01:~# apt install iptables-persistent root@slave01:~# apt install iptables-persistent
 </code> </code>
  
 <code> <code>
-[trainee@slave02 ~]$ su - 
-Mot de passe :  
-Dernière connexion : mercredi 13 mars 2019 à 16:30:58 CET sur pts/0 
 [root@slave02 ~]# systemctl stop firewalld && systemctl disable firewalld [root@slave02 ~]# systemctl stop firewalld && systemctl disable firewalld
 Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Ligne 742: Ligne 843:
 </code> </code>
  
-Installez le module Puppet **puppetlabs-firewall** dans la machine virtuelle **master** :+Installez le module Puppet **puppetlabs-firewall** dans la machine virtuelle **puppetmaster** :
  
 <code> <code>
Ligne 750: Ligne 851:
 Notice: Installing -- do not interrupt ... Notice: Installing -- do not interrupt ...
 /etc/puppetlabs/code/environments/production/modules /etc/puppetlabs/code/environments/production/modules
-└─┬ puppetlabs-firewall (v1.15.2) +└─┬ puppetlabs-firewall (v2.2.0
-  └── puppetlabs-stdlib (v5.2.0)+  └── puppetlabs-stdlib (v6.2.0)
 </code> </code>
  
-Naviguez maintenant vers le répertoire **/etc/puppetlabs/code/environments/production/modules/firewall/manifests/>** :+Naviguez maintenant vers le répertoire **/etc/puppetlabs/code/environments/production/modules/firewall/manifests/** :
  
 <code> <code>
Ligne 827: Ligne 928:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo vi post.pp toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo vi post.pp
-[sudo] password for toto: toto 
 toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ cat post.pp toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ cat post.pp
 class firewall::post { class firewall::post {
Ligne 844: Ligne 944:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate pre.pp toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate pre.pp
 +toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ 
 toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate post.pp toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate post.pp
 +toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ 
 +</code>
 +
 +Vérifiez l'arborescence du répertoire **manifests** :
 +
 +<code>
 +toto@master:/etc/puppetlabs/code/environments/production/modules/firewall/manifests$ tree
 +.
 +├── init.pp
 +├── linux
 +│   ├── archlinux.pp
 +│   ├── debian.pp
 +│   ├── gentoo.pp
 +│   └── redhat.pp
 +├── linux.pp
 +├── params.pp
 +├── post.pp
 +└── pre.pp
 +
 +1 directory, 9 files
 </code> </code>
  
Ligne 854: Ligne 975:
 </code> </code>
  
-Créez le fichier **site.pp** qui pilote l'ensemble des autres classes définies dasn les fichiers précédents :+Créez le fichier **site.pp** qui pilote l'ensemble des autres classes définies dans les fichiers précédents :
  
 <code> <code>
Ligne 898: Ligne 1019:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/manifests$ sudo /opt/puppetlabs/bin/puppet apply --noop site.pp toto@master:/etc/puppetlabs/code/environments/production/manifests$ sudo /opt/puppetlabs/bin/puppet apply --noop site.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.13 seconds+Notice: Compiled catalog for master.i2tch.loc in environment production in 0.14 seconds
 Notice: /Stage[main]/Firewall::Pre/Firewall[000 lo traffic]/ensure: current_value 'absent', should be 'present' (noop) Notice: /Stage[main]/Firewall::Pre/Firewall[000 lo traffic]/ensure: current_value 'absent', should be 'present' (noop)
 Notice: /Stage[main]/Firewall::Pre/Firewall[001 reject non-lo]/ensure: current_value 'absent', should be 'present' (noop) Notice: /Stage[main]/Firewall::Pre/Firewall[001 reject non-lo]/ensure: current_value 'absent', should be 'present' (noop)
Ligne 913: Ligne 1034:
 Notice: Class[Firewall::Post]: Would have triggered 'refresh' from 1 event Notice: Class[Firewall::Post]: Would have triggered 'refresh' from 1 event
 Notice: Stage[main]: Would have triggered 'refresh' from 3 events Notice: Stage[main]: Would have triggered 'refresh' from 3 events
-Notice: Applied catalog in 0.22 seconds+Notice: Applied catalog in 0.17 seconds
 </code> </code>
  
Ligne 930: Ligne 1051:
 Notice: /Stage[main]/Main/Node[master.i2tch.loc]/Firewall[200 Allow Puppet Master]/ensure: created Notice: /Stage[main]/Main/Node[master.i2tch.loc]/Firewall[200 Allow Puppet Master]/ensure: created
 Notice: /Stage[main]/Firewall::Post/Firewall[999 drop all]/ensure: created Notice: /Stage[main]/Firewall::Post/Firewall[999 drop all]/ensure: created
-Notice: Applied catalog in 1.56 seconds+Notice: Applied catalog in 0.98 seconds
 </code> </code>
  
Ligne 956: Ligne 1077:
 </code> </code>
  
-Modifiez le manifest **site.pp** pour inclure les sections pour déclarer les classes, les modules et les ressources à appliquer à **node01.i2tch.loc** et à **node02.i2tch.loc** :+Modifiez le manifest **site.pp** pour inclure les sections pour déclarer les classes, les modules et les ressources à appliquer à **slave01.i2tch.loc** et à **slave02.i2tch.loc** :
  
 <code> <code>
Ligne 1023: Ligne 1144:
 </code> </code>
  
-===Exécuter l'Agent Puppet sur node01.i2tch.loc===+====Exécuter l'Agent Puppet sur slave01.i2tch.loc====
  
-Connectez-vous à la machine virtuelle **node01.i2tch.loc** en tant que **root** :+Connectez-vous à la machine virtuelle **slave01.i2tch.loc** en ssh et devenez **root** :
  
 <code> <code>
-hnorris@docker:~$ ssh -l trainee localhost -p 2522 
-trainee@localhost's password: trainee 
-Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64) 
- 
- * Documentation:  https://help.ubuntu.com 
- * Management:     https://landscape.canonical.com 
- * Support:        https://ubuntu.com/advantage 
- 
- 
- * Canonical Livepatch is available for installation. 
-   - Reduce system reboots and improve kernel security. Activate at: 
-     https://ubuntu.com/livepatch 
- 
-330 packages can be updated. 
-8 updates are security updates. 
- 
-*** System restart required *** 
-Last login: Tue Apr  2 11:03:28 2019 from 10.0.2.2 
 trainee@slave01:~$ su - trainee@slave01:~$ su -
 Password: fenestros Password: fenestros
Ligne 1054: Ligne 1157:
 <code> <code>
 root@slave01:~# /opt/puppetlabs/bin/puppet agent -t root@slave01:~# /opt/puppetlabs/bin/puppet agent -t
-InfoUsing configured environment 'production+... 
-InfoRetrieving pluginfacts +Notice: /Stage[main]/Accounts::Ssh/Service[ssh]Triggered 'refreshfrom 1 event 
-InfoRetrieving plugin +Notice/Stage[main]/Accounts/User[toto]/ensure: created 
-InfoRetrieving locales +Notice: /Stage[main]/Firewall::Pre/Firewall[000 lo traffic]/ensurecreated 
-InfoLoading facts +Notice: /Stage[main]/Firewall::Pre/Firewall[001 reject non-lo]/ensurecreated 
-InfoCaching catalog for slave01.i2tch.loc +Notice/Stage[main]/Firewall::Pre/Firewall[002 accept established]/ensure: created 
-InfoApplying configuration version '1554221948' +Notice/Stage[main]/Firewall::Pre/Firewall[003 allow outbound]/ensure: created 
-Notice: Applied catalog in 0.25 seconds+Notice/Stage[main]/Firewall::Pre/Firewall[004 allow icmp]/ensure: created 
 +Notice: /Stage[main]/Firewall::Pre/Firewall[005 Allow SSH]/ensure: created 
 +Notice: /Stage[main]/Firewall::Pre/Firewall[006 HTTP/HTTPS connections]/ensure: created 
 +Notice: /Stage[main]/Firewall::Post/Firewall[999 drop all]/ensure: created 
 +Notice: Applied catalog in 1.78 seconds
 </code> </code>
  
Ligne 1074: Ligne 1181:
 </code> </code>
  
-Re-connectez-vous en tant que l'utilisateur **toto** :+Re-connectez-vous à la machine virtuelle **slave01.i2tch.loc** en ssh et en tant que l'utilisateur **toto** :
  
 <code> <code>
-hnorris@docker:~$ ssh -l toto localhost -p 2522 +...
-toto@localhost's password: +
 Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64) Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64)
  
Ligne 1131: Ligne 1237:
 </code> </code>
  
-===Exécuter l'Agent Puppet sur node02.i2tch.loc===+====Exécuter l'Agent Puppet sur slave02.i2tch.loc====
  
-Connectez-vous à la machine virtuelle **node02.i2tch.loc** en tant que **root** :+Connectez-vous à la machine virtuelle **slave02.i2tch.loc** en ssh et devenez **root** :
  
 <code> <code>
-hnorris@docker:~$ ssh -l trainee localhost -p 2622 
-trainee@localhost's password: trainee 
-Last login: Wed Mar 13 16:30:44 2019 from gateway 
 [trainee@slave02 ~]$ su - [trainee@slave02 ~]$ su -
 Mot de passe : fenestros Mot de passe : fenestros
Ligne 1149: Ligne 1252:
 <code> <code>
 [root@slave02 ~]# /opt/puppetlabs/bin/puppet agent -t [root@slave02 ~]# /opt/puppetlabs/bin/puppet agent -t
-InfoUsing configured environment 'production' +... 
-InfoRetrieving pluginfacts +Notice: /Stage[main]/Firewall::Pre/Firewall[000 lo traffic]/ensurecreated 
-InfoRetrieving plugin +Notice: /Stage[main]/Firewall::Pre/Firewall[001 reject non-lo]/ensurecreated 
-InfoRetrieving locales +Notice: /Stage[main]/Firewall::Pre/Firewall[002 accept established]/ensurecreated 
-InfoLoading facts +Notice: /Stage[main]/Firewall::Pre/Firewall[003 allow outbound]/ensurecreated 
-InfoCaching catalog for slave02.i2tch.loc +Notice: /Stage[main]/Firewall::Pre/Firewall[004 allow icmp]/ensurecreated 
-InfoApplying configuration version '1554222588' +Notice/Stage[main]/Firewall::Pre/Firewall[005 Allow SSH]/ensure: created 
-Notice: Applied catalog in 0.22 seconds+Notice: /Stage[main]/Firewall::Pre/Firewall[006 HTTP/HTTPS connections]/ensure: created 
 +Notice: /Stage[main]/Firewall::Post/Firewall[999 drop all]/ensurecreated 
 +Notice: Applied catalog in 0.97 seconds
 </code> </code>
  
Ligne 1169: Ligne 1274:
 </code> </code>
  
-Re-connectez-vous en tant que l'utilisateur **toto** :+Re-connectez-vous à la machine virtuelle **slave02.i2tch.loc** en ssh et en tant que l'utilisateur **toto**. Vérifiez que les règles du pare-feu ont été appliquées :
  
 <code> <code>
-hnorris@docker:~$ ssh -l toto localhost -p 2622 +-bash-4.2$ sudo iptables -L
-toto@localhost's password: toto  +
-[toto@slave02 ~]$  +
-</code> +
- +
-Vérifiez que les règles du pare-feu ont été appliquées : +
- +
-<code> +
-[toto@slave02 ~]$ sudo iptables -L+
  
 Nous espérons que vous avez reçu de votre administrateur système local les consignes traditionnelles. Généralement, elles se concentrent sur ces trois éléments : Nous espérons que vous avez reçu de votre administrateur système local les consignes traditionnelles. Généralement, elles se concentrent sur ces trois éléments :
Ligne 1188: Ligne 1285:
     #3) De grands pouvoirs confèrent de grandes responsabilités.     #3) De grands pouvoirs confèrent de grandes responsabilités.
  
-[sudo] Mot de passe de toto : +[sudo] Mot de passe de toto : toto
 Chain INPUT (policy ACCEPT) Chain INPUT (policy ACCEPT)
 target     prot opt source               destination          target     prot opt source               destination         
Ligne 1207: Ligne 1304:
 </code> </code>
  
-=====LAB #28 - Déployer Apache avec Puppet en mode Agent/Maître=====+=====LAB #- Déployer Apache avec Puppet en mode Agent/Maître===== 
 + 
 +Le but ici est de créer un rôle contenant les fichiers suivants : 
 + 
 +<file> 
 +
 +├── examples 
 +│   └── init.pp 
 +├── files 
 +│   ├── apache2.conf 
 +│   └── httpd.conf 
 +├── manifests 
 +│   ├── init.pp 
 +│   ├── params.pp 
 +│   └── vhosts.pp 
 +└── templates 
 +    ├── vhosts-deb.conf.erb 
 +    └── vhosts-rh.conf.erb 
 +</file>
  
 ====Création du Rôle==== ====Création du Rôle====
  
-Naviguez vers le répertoire **/etc/puppetlabs/code/environments/production/modules/** et créez lz sous-répertoire **apache** :+Naviguez vers le répertoire **/etc/puppetlabs/code/environments/production/modules/** et créez le sous-répertoire **apache** :
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/manifests$ cd /etc/puppetlabs/code/environments/production/modules/+toto@master:/etc/puppetlabs/code/environments/production/manifests$ cd ../modules/ 
 +toto@master:/etc/puppetlabs/code/environments/production/modules
 toto@master:/etc/puppetlabs/code/environments/production/modules$ sudo mkdir apache toto@master:/etc/puppetlabs/code/environments/production/modules$ sudo mkdir apache
-[sudo] password for toto: toto 
 </code> </code>
  
Ligne 1226: Ligne 1341:
 </code> </code>
  
-====Création des Mainifests====+====Création des Manifests====
  
 Placez-vous dans le répertoire **/etc/puppetlabs/code/environments/production/modules/apache/manifests** : Placez-vous dans le répertoire **/etc/puppetlabs/code/environments/production/modules/apache/manifests** :
Ligne 1269: Ligne 1384:
   * le paquet à installer est référencé par une variable **$apachename**,   * le paquet à installer est référencé par une variable **$apachename**,
   * la variable $apachename est fixée par la classe **apache::params** et injecté dans le fichier grâce à **$apachename   = $::apache::params::apachename**,   * la variable $apachename est fixée par la classe **apache::params** et injecté dans le fichier grâce à **$apachename   = $::apache::params::apachename**,
-  * la ressource **file** utilise deux variables, **$conffile** et **$consource**, également fixées par la classe apache::params.+  * la ressource **file** utilise deux variables, **$conffile** et **$confsource**, également fixées par la classe apache::params.
  
 Créez ensuite le manifest **params.pp** pour définir la classe **apache::params** : Créez ensuite le manifest **params.pp** pour définir la classe **apache::params** :
Ligne 1295: Ligne 1410:
 </code> </code>
  
-Les hôtes virtuels d'Apache sont gérés différement selon que **$::osfamily** soit RedHat ou Debian. Créez donc le manifest **vhosts.pp** :+Les hôtes virtuels d'Apache sont gérés différemment selon que **$::osfamily** soit RedHat ou Debian. Créez donc le manifest **vhosts.pp** :
  
 <code> <code>
Ligne 1307: Ligne 1422:
       content   => template('apache/vhosts-rh.conf.erb'),       content   => template('apache/vhosts-rh.conf.erb'),
     }     }
-    file { [ '/var/www/$servername'+    file { [ "/var/www/$servername"
-             '/var/www/$servername/public_html'+             "/var/www/$servername/public_html"
-             '/var/www/$servername/log', ]:+             "/var/www/$servername/logs", ]:
       ensure    => directory,       ensure    => directory,
     }     }
Ligne 1317: Ligne 1432:
       content  => template('apache/vhosts-deb.conf.erb'),       content  => template('apache/vhosts-deb.conf.erb'),
     }     }
-    file { [ '/var/www/$servername'+    file { [ "/var/www/$servername"
-             '/var/www/$servername/public_html'+             "/var/www/$servername/public_html"
-             '/var/www/$servername/logs', ]:+             "/var/www/$servername/logs", ]:
       ensure    => directory,       ensure    => directory,
     }     }
Ligne 1336: Ligne 1451:
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ cd /etc/puppetlabs/code/environments/production/modules/apache/files +toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ cd ../files
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/files$ +toto@master:/etc/puppetlabs/code/environments/production/modules/apache/files$  
 </code> </code>
  
Ligne 1935: Ligne 2050:
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ cd /etc/puppetlabs/code/environments/production/modules/apache/templates+toto@master:/etc/puppetlabs/code/environments/production/modules/apache/files$ cd ../templates/
 toto@master:/etc/puppetlabs/code/environments/production/modules/apache/templates$ toto@master:/etc/puppetlabs/code/environments/production/modules/apache/templates$
 </code> </code>
Ligne 1949: Ligne 2064:
     ServerAlias www.<%= @servername %>     ServerAlias www.<%= @servername %>
     DocumentRoot /var/www/<%= @servername -%>/public_html/     DocumentRoot /var/www/<%= @servername -%>/public_html/
-    ErrorLog /var/www/<%@servername -%>/logs/error.log+    ErrorLog /var/www/<%@servername -%>/logs/error.log
     CustomLog /var/www/<%= @servername -%>/logs/access.log combined     CustomLog /var/www/<%= @servername -%>/logs/access.log combined
-</Virtual Host>+</VirtualHost>
 </code> </code>
  
Ligne 1964: Ligne 2079:
     ServerAlias www.<%= @servername %>     ServerAlias www.<%= @servername %>
     DocumentRoot /var/www/html/<%= @servername -%>/public_html/     DocumentRoot /var/www/html/<%= @servername -%>/public_html/
-    ErrorLog /var/www/html/<%@servername -%>/logs/error.log+    ErrorLog /var/www/html/<%@servername -%>/logs/error.log
     CustomLog /var/www/html/<%= @servername -%>/logs/access.log combined     CustomLog /var/www/html/<%= @servername -%>/logs/access.log combined
     <Directory /var/www/html/<%= @servername -%>/public_html>     <Directory /var/www/html/<%= @servername -%>/public_html>
         Require all granted         Require all granted
     </Directory>     </Directory>
-</Virtual Host>+</VirtualHost> 
 +</code> 
 + 
 +Naviguez au répertoire **/etc/puppetlabs/code/environments/production/modules/apache** et vérifiez l'arborescence du module : 
 + 
 +<code> 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/apache/templates$ cd .. 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/apache$ tree 
 +
 +├── examples 
 +├── files 
 +│   ├── apache2.conf 
 +│   └── httpd.conf 
 +├── manifests 
 +│   ├── init.pp 
 +│   ├── params.pp 
 +│   └── vhosts.pp 
 +└── templates 
 +    ├── vhosts-deb.conf.erb 
 +    └── vhosts-rh.conf.erb 
 </code> </code>
  
Ligne 1977: Ligne 2111:
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/templates$ cd /etc/puppetlabs/code/environments/production/modules/apache/manifests +toto@master:/etc/puppetlabs/code/environments/production/modules/apache$ cd manifests
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$+toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ 
 </code> </code>
  
Ligne 1985: Ligne 2119:
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate init.pp params.pp vhosts.pp toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ sudo /opt/puppetlabs/bin/puppet parser validate init.pp params.pp vhosts.pp
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$+toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ 
 </code> </code>
  
Ligne 1991: Ligne 2125:
  
 <code> <code>
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ cd /etc/puppetlabs/code/environments/production/modules/apache/examples +toto@master:/etc/puppetlabs/code/environments/production/modules/apache/manifests$ cd ../examples
-toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$+toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ 
 </code> </code>
  
-Créez le fichier **init.pp** pour définir les valeurs des deux variables **$serveremail** et **$servername** :+Créez le fichier **init.pp** pour définir les valeurs des deux variables **$adminemail** et **$servername** :
  
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ sudo vi init.pp toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ sudo vi init.pp
 toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ cat init.pp toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ cat init.pp
-$serveremail = 'webmaster@i2tch.loc'+$adminemail = 'webmaster@i2tch.loc'
 $servername = 'i2tch.loc' $servername = 'i2tch.loc'
  
Ligne 2007: Ligne 2141:
 </code> </code>
  
-Testez l'exécution avec l'option **--noop** :+Naviguez au répertoire **/etc/puppetlabs/code/environments/production/modules/apache** et vérifiez l'arborescence du module : 
 + 
 +<code> 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ cd .. 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/apache$ tree 
 +
 +├── examples 
 +│   └── init.pp 
 +├── files 
 +│   ├── apache2.conf 
 +│   └── httpd.conf 
 +├── manifests 
 +│   ├── init.pp 
 +│   ├── params.pp 
 +│   └── vhosts.pp 
 +└── templates 
 +    ├── vhosts-deb.conf.erb 
 +    └── vhosts-rh.conf.erb 
 + 
 +4 directories, 8 files 
 +</code> 
 + 
 +Retournez au répertoire **/etc/puppetlabs/code/environments/production/modules/apache/examples** : 
 + 
 +<code> 
 +toto@master:/etc/puppetlabs/code/environments/production/modules/apache$ cd examples/ 
 +</code> 
 + 
 +Testez l'application avec l'option **--noop** :
  
 <code> <code>
 toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ sudo /opt/puppetlabs/bin/puppet apply --noop init.pp toto@master:/etc/puppetlabs/code/environments/production/modules/apache/examples$ sudo /opt/puppetlabs/bin/puppet apply --noop init.pp
-Notice: Compiled catalog for master.i2tch.loc in environment production in 0.10 seconds+Notice: Compiled catalog for master.i2tch.loc in environment production in 0.03 seconds
 Notice: /Stage[main]/Apache/Package[apache]/ensure: current_value 'purged', should be 'present' (noop) Notice: /Stage[main]/Apache/Package[apache]/ensure: current_value 'purged', should be 'present' (noop)
 Notice: /Stage[main]/Apache/File[configuration-file]/ensure: current_value 'absent', should be 'file' (noop) Notice: /Stage[main]/Apache/File[configuration-file]/ensure: current_value 'absent', should be 'file' (noop)
-Notice: Class[Apache]: Would have triggered 'refresh' from events+Notice: /Stage[main]/Apache/Service[apache-service]: Would have triggered 'refresh' from 1 event 
 +Notice: Class[Apache]: Would have triggered 'refresh' from events
 Notice: /Stage[main]/Apache::Vhosts/File[/etc/apache2/sites-available/i2tch.loc.conf]/ensure: current_value 'absent', should be 'file' (noop) Notice: /Stage[main]/Apache::Vhosts/File[/etc/apache2/sites-available/i2tch.loc.conf]/ensure: current_value 'absent', should be 'file' (noop)
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername]/ensure: current_value 'absent', should be 'directory' (noop) +Notice: /Stage[main]/Apache::Vhosts/File[/var/www/i2tch.loc]/ensure: current_value 'absent', should be 'directory' (noop) 
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/public_html]/ensure: current_value 'absent', should be 'directory' (noop) +Notice: /Stage[main]/Apache::Vhosts/File[/var/www/i2tch.loc/public_html]/ensure: current_value 'absent', should be 'directory' (noop) 
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/logs]/ensure: current_value 'absent', should be 'directory' (noop)+Notice: /Stage[main]/Apache::Vhosts/File[/var/www/i2tch.loc/logs]/ensure: current_value 'absent', should be 'directory' (noop)
 Notice: Class[Apache::Vhosts]: Would have triggered 'refresh' from 4 events Notice: Class[Apache::Vhosts]: Would have triggered 'refresh' from 4 events
 Notice: Stage[main]: Would have triggered 'refresh' from 2 events Notice: Stage[main]: Would have triggered 'refresh' from 2 events
-Notice: Applied catalog in 0.13 seconds+Notice: Applied catalog in 0.14 seconds
 </code> </code>
  
Ligne 2110: Ligne 2273:
 <code> <code>
 toto@slave01:~$ sudo /opt/puppetlabs/bin/puppet agent -t toto@slave01:~$ sudo /opt/puppetlabs/bin/puppet agent -t
-[sudo] password for toto: toto+[sudo] password for toto: 
 Info: Using configured environment 'production' Info: Using configured environment 'production'
 Info: Retrieving pluginfacts Info: Retrieving pluginfacts
Ligne 2117: Ligne 2280:
 Info: Loading facts Info: Loading facts
 Info: Caching catalog for slave01.i2tch.loc Info: Caching catalog for slave01.i2tch.loc
-Info: Applying configuration version '1554230049+Info: Applying configuration version '1582373993
-Notice: /Stage[main]/Apache/Package[apache]/ensure: created +... 
-Notice: /Stage[main]/Apache/File[configuration-file]/content:  +Notice: Applied catalog in 24.16 seconds
---- /etc/apache2/apache2.conf 2018-10-10 20:59:25.000000000 +0200 +
-+++ /tmp/puppet-file20190402-1026-1576q72 2019-04-02 20:34:38.571435434 +0200 +
-@@ -1,6 +1,6 @@ +
- # This is the main Apache server configuration file.  It contains the +
- # configuration directives that give the server its instructions. +
--# See http://httpd.apache.org/docs/2.4/ for detailed information about +
-+# See http://httpd.apache.org/content/2.4/ for detailed information about +
- # the directives and /usr/share/doc/apache2/README.Debian about Debian specific +
- # hints. +
- # +
-@@ -61,7 +61,7 @@ +
- # +
- # NOTE!  If you intend to place this on an NFS (or otherwise network) +
- # mounted filesystem then please read the Mutex documentation (available +
--# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>); +
-+# at <URL:http://httpd.apache.org/content/2.4/mod/core.html#mutex>); +
- # you will save yourself a lot of trouble. +
- # +
- # Do NOT add a slash at the end of the directory path. +
-@@ -71,13 +71,7 @@ +
- # +
- # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. +
- # +
--#Mutex file:${APACHE_LOCK_DIR} default +
-+
--# +
--# The directory where shm and other runtime files will be stored. +
--# +
-+
--DefaultRuntimeDir ${APACHE_RUN_DIR} +
-+Mutex file:${APACHE_LOCK_DIR} default +
-  +
- # +
- # PidFile: The file in which the server should record its process +
- +
-Info: Computing checksum on file /etc/apache2/apache2.conf +
-Info: /Stage[main]/Apache/File[configuration-file]: Filebucketed /etc/apache2/apache2.conf to puppet with sum 20589b50379161ebc8cb35f761af2646 +
-Notice: /Stage[main]/Apache/File[configuration-file]/content: content changed '{md5}20589b50379161ebc8cb35f761af2646' to '{md5}6564b9fe1beba5c9ff1b47d106692264' +
-Notice: /Stage[main]/Apache::Vhosts/File[/etc/apache2/sites-available/slave01.i2tch.loc.conf]/ensure: defined content as '{md5}c90109cfa21d1f1a2ab612210fcb0ba6' +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername]/ensure: created +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/public_html]/ensure: created +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/logs]/ensure: created +
-Notice: Applied catalog in 27.66 seconds+
 </code> </code>
  
Ligne 2168: Ligne 2288:
  
 <code> <code>
-[toto@slave02 ~]$ sudo /opt/puppetlabs/bin/puppet agent -t +-bash-4.2$ sudo /opt/puppetlabs/bin/puppet agent -t 
-[sudo] Mot de passe de toto : toto+[sudo] Mot de passe de toto : 
 Info: Using configured environment 'production' Info: Using configured environment 'production'
 Info: Retrieving pluginfacts Info: Retrieving pluginfacts
Ligne 2176: Ligne 2296:
 Info: Loading facts Info: Loading facts
 Info: Caching catalog for slave02.i2tch.loc Info: Caching catalog for slave02.i2tch.loc
-Info: Applying configuration version '1554230089+Info: Applying configuration version '1582374068
-Notice: /Stage[main]/Apache/Package[apache]/ensure: created +... 
-Notice: /Stage[main]/Apache/File[configuration-file]/content:  +Notice: Applied catalog in 39.38 seconds
---- /etc/httpd/conf/httpd.conf 2018-10-30 16:00:25.000000000 +0100 +
-+++ /tmp/puppet-file20190314-13087-d6akfy 2019-03-14 01:43:27.759770947 +0100 +
-@@ -1,9 +1,9 @@ +
- # +
- # This is the main Apache HTTP server configuration file.  It contains the +
- # configuration directives that give the server its instructions. +
--# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. +
-+# See <URL:http://httpd.apache.org/content/2.4/> for detailed information. +
- # In particular, see  +
--# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> +
-+# <URL:http://httpd.apache.org/content/2.4/mod/directives.html> +
- # for a discussion of each configuration directive. +
- # +
- # Do NOT simply read the instructions in here without understanding +
-@@ -138,7 +138,7 @@ +
-     # doesn't give it to you. +
-     # +
-     # The Options directive is both complicated and important.  Please see +
--    # http://httpd.apache.org/docs/2.4/mod/core.html#options +
-+    # http://httpd.apache.org/content/2.4/mod/core.html#options +
-     # for more information. +
-     # +
-     Options Indexes FollowSymLinks +
- +
-Info: Computing checksum on file /etc/httpd/conf/httpd.conf +
-Info: /Stage[main]/Apache/File[configuration-file]: Filebucketed /etc/httpd/conf/httpd.conf to puppet with sum f5e7449c0f17bc856e86011cb5d152ba +
-Notice: /Stage[main]/Apache/File[configuration-file]/content: content changed '{md5}f5e7449c0f17bc856e86011cb5d152ba' to '{md5}a166b8f3540524cd0c9b400152deaa5f' +
-Notice: /Stage[main]/Apache::Vhosts/File[/etc/httpd/conf.d/vhost.conf]/ensure: defined content as '{md5}adddb24366c3902efeb2d0153d61009c' +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername]/ensure: created +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/public_html]/ensure: created +
-Notice: /Stage[main]/Apache::Vhosts/File[/var/www/$servername/log]/ensure: created +
-Notice: Applied catalog in 141.82 seconds+
 </code> </code>
  
----- +----- 
-<html> + 
-<DIV ALIGN="CENTER"> +Copyright © 2022 Hugh Norris.
-Copyright © 2019 Hugh Norris. +
-</div> +
-</html>+
Menu