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:centos:8:lcf900:l704 [2023/09/26 09:22] adminelearning:workbooks:centos:8:lcf900:l704 [2024/12/03 14:37] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2023.01**+Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
Ligne 9: Ligne 9:
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF804 - Utilisation d'Ansible avec Docker et Windows**+  * **LDF904 - Utilisation d'Ansible avec Docker et Windows**
     * Contenu du Module     * Contenu du Module
     * LAB #1 - Ansible et Docker     * LAB #1 - Ansible et Docker
Ligne 441: Ligne 441:
  
 <code> <code>
-PS C:\Windows\system32> $url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"+PS C:\Windows\system32> $url = "https://raw.githubusercontent.com/AlbanAndrieu/ansible-windows/master/files/ConfigureRemotingForAnsible.ps1"
 PS C:\Windows\system32> $file = "$env:temp\ConfigureRemotingForAnsible.ps1" PS C:\Windows\system32> $file = "$env:temp\ConfigureRemotingForAnsible.ps1"
 PS C:\Windows\system32> (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file) PS C:\Windows\system32> (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
Ligne 580: Ligne 580:
 ====2.4 - Créer un Utilisateur Local pour Ansible==== ====2.4 - Créer un Utilisateur Local pour Ansible====
  
-Exécutez ensuite la commande suivante :+Retournez à l'accueil de Guacamole et connectez-vous à la machine virtuelle **Windows_10.0.2.58_VNC**. 
 + 
 +Lancez PowerShell en tant que l'administrateur et exécutez ensuite la commande suivante :
  
 <code> <code>
Ligne 620: Ligne 622:
 ====3.1 - Installer pywinrm==== ====3.1 - Installer pywinrm====
  
-Dans la machine virtuelle **centos8**, installez le support python pour WinRM :+Sous Debian 11, le paquet **python3-winrm** est déjà installé. 
 + 
 +Modifiez le fichier **/etc/hosts** :
  
 <code> <code>
-[trainee@centos8 ~]$ su -+trainee@debian11:~/.ansible/roles$ su -
 Password: fenestros Password: fenestros
  
-[root@centos8 ~]pip3 install "pywinrm>=0.3.0" +root@debian11:~# vi /etc/hosts
-Collecting pywinrm>=0.3.0 +
-  Downloading pywinrm-0.4.2-py2.py3-none-any.whl (44 kB) +
-     |████████████████████████████████| 44 kB 250 kB/s              +
-Collecting xmltodict +
-  Downloading xmltodict-0.12.0-py2.py3-none-any.whl (9.2 kB) +
-Requirement already satisfied: requests>=2.9.1 in /usr/lib/python3.6/site-packages (from pywinrm>=0.3.0) (2.20.0) +
-Requirement already satisfied: six in /usr/lib/python3.6/site-packages (from pywinrm>=0.3.0) (1.11.0) +
-Collecting requests-ntlm>=0.3.0 +
-  Downloading requests_ntlm-1.1.0-py2.py3-none-any.whl (5.7 kB) +
-Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.6/site-packages (from requests>=2.9.1->pywinrm>=0.3.0) (3.0.4) +
-Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python3.6/site-packages (from requests>=2.9.1->pywinrm>=0.3.0) (2.5) +
-Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/lib/python3.6/site-packages (from requests>=2.9.1->pywinrm>=0.3.0) (1.24.2) +
-Collecting ntlm-auth>=1.0.2 +
-  Downloading ntlm_auth-1.5.0-py2.py3-none-any.whl (29 kB) +
-Requirement already satisfied: cryptography>=1.3 in /usr/local/lib64/python3.6/site-packages (from requests-ntlm>=0.3.0->pywinrm>=0.3.0) (36.0.1) +
-Requirement already satisfied: cffi>=1.12 in /usr/local/lib64/python3.6/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm>=0.3.0) (1.15.0) +
-Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.12->cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm>=0.3.0) (2.21) +
-Installing collected packages: ntlm-auth, xmltodict, requests-ntlm, pywinrm +
-Successfully installed ntlm-auth-1.5.0 pywinrm-0.4.2 requests-ntlm-1.1.0 xmltodict-0.12.0 +
-WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv +
-</code>+
  
-Modifiez ensuite le fichier **/etc/hosts** : +root@debian11:~# cat /etc/hosts 
- +127.0.0.1       localhost 
-<code> +10.0.2.46       debian11.ittraining.loc debian11
-[trainee@centos8 ~]$ su - +
-Passwordfenestros +
-[root@centos8 ~]# vi /etc/hosts +
-[root@centos8 ~]# cat /etc/hosts +
-127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 +
-::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 +
-10.0.2.45 centos8.ittraining.loc centos8+
 10.0.2.54 web01.i2tch.loc web01 10.0.2.54 web01.i2tch.loc web01
 10.0.2.55 web02.i2tch.loc web02 10.0.2.55 web02.i2tch.loc web02
Ligne 666: Ligne 642:
 10.0.2.53 targetb.i2tch.loc targetb 10.0.2.53 targetb.i2tch.loc targetb
 10.0.2.58 windows10 10.0.2.58 windows10
 +
 +# The following lines are desirable for IPv6 capable hosts
 +::1     localhost ip6-localhost ip6-loopback
 +ff02::1 ip6-allnodes
 +ff02::2 ip6-allrouters
 </code> </code>
  
Ligne 673: Ligne 654:
  
 <code> <code>
-[root@centos8 ~]# exit+root@debian11:~# exit
 logout logout
-[trainee@centos8 ~]$ vi inventory + 
-[trainee@centos8 ~]$ cat inventory+trainee@debian11:~$ vi inventory 
 + 
 +trainee@debian11:~$ cat inventory
 [windows] [windows]
 windows10 windows10
Ligne 690: Ligne 673:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible windows -i inventory -m win_ping+trainee@debian11:~$ ansible windows -i inventory -m win_ping
 windows10 | SUCCESS => { windows10 | SUCCESS => {
     "changed": false,     "changed": false,
Ligne 704: Ligne 687:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible windows -i inventory -m setup+trainee@debian11:~$ ansible windows -i inventory -m setup
 windows10 | SUCCESS => { windows10 | SUCCESS => {
     "ansible_facts": {     "ansible_facts": {
Ligne 871: Ligne 854:
  
 <code> <code>
-[trainee@centos8 ~]$ vi command.yml +trainee@debian11:~$ vi command.yml 
-[trainee@centos8 ~]$ cat command.yml+trainee@debian11:~$ cat command.yml
 --- ---
 - name: ipconfig - name: ipconfig
Ligne 886: Ligne 869:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible-playbook command.yml -i inventory+trainee@debian11:~$ ansible-playbook command.yml -i inventory
  
 PLAY [ipconfig] ************************************************************************************************************************************************************************************************** PLAY [ipconfig] **************************************************************************************************************************************************************************************************
Ligne 934: Ligne 917:
  
 <code> <code>
-[trainee@centos8 ~]$ vi script1.ps1 +trainee@debian11:~$ vi script1.ps1 
-[trainee@centos8 ~]$ cat script1.ps1+trainee@debian11:~$ cat script1.ps1
 Start-Service -Name wuauserv Start-Service -Name wuauserv
 </code> </code>
Ligne 942: Ligne 925:
  
 <code> <code>
-[trainee@centos8 ~]$ vi winupdate.yml +trainee@debian11:~$ vi winupdate.yml 
-[trainee@centos8 ~]$ cat winupdate.yml+trainee@debian11:~$ cat winupdate.yml
 - name: "PowerShell script" - name: "PowerShell script"
   hosts: "windows"   hosts: "windows"
Ligne 955: Ligne 938:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible-playbook winupdate.yml -i inventory+trainee@debian11:~$ ansible-playbook winupdate.yml -i inventory
  
 PLAY [PowerShell script] ***************************************************************************************************************************************************************************************** PLAY [PowerShell script] *****************************************************************************************************************************************************************************************
Ligne 973: Ligne 956:
  
 <code> <code>
-[trainee@centos8 ~]$ vi firefox.yml +trainee@debian11:~$ vi firefox.yml 
-[trainee@centos8 ~]$ cat firefox.yml+trainee@debian11:~$ cat firefox.yml
 --- ---
 - name: Install Firefox using Chocolatey - name: Install Firefox using Chocolatey
Ligne 988: Ligne 971:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible-playbook firefox.yml -i inventory+trainee@debian11:~$ ansible-playbook firefox.yml -i inventory
  
 PLAY [Install Firefox using Chocolatey] ************************************************************************************************************************************************************************** PLAY [Install Firefox using Chocolatey] **************************************************************************************************************************************************************************
Ligne 1008: Ligne 991:
  
 <code> <code>
-[trainee@centos8 ~]$ vi users.yml +trainee@debian11:~$ vi users.yml 
-[trainee@centos8 ~]$ cat users.yml+trainee@debian11:~$ cat users.yml
 --- ---
 - name: Create a user - name: Create a user
Ligne 1026: Ligne 1009:
  
 <code> <code>
-[trainee@centos8 ~]$ ansible-playbook users.yml -i inventory+trainee@debian11:~$ ansible-playbook users.yml -i inventory
  
 PLAY [Create a user] ********************************************************************************************************************************************************************************************* PLAY [Create a user] *********************************************************************************************************************************************************************************************
Ligne 1046: Ligne 1029:
 ----- -----
  
-Copyright © 2023 Hugh Norris.+Copyright © 2024 Hugh Norris.
Menu