Ansible Windows Host: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Mario.zimmermann (Diskussion | Beiträge)
Linkai.zhang (Diskussion | Beiträge)
 
(21 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 19: Zeile 19:
==Install WinRM==
==Install WinRM==
*Ansible Team stellt Script für Installation zur Verfügung
*Ansible Team stellt Script für Installation zur Verfügung
*Das Scipt muss mit Adminrechten und der Powershell ausgeführt werden.
*Damit das Script heruntergelanden und ausgeführt werden kann, muss der Internet Explorer einmal gestartet werden.
iex(iwr https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1).Content
*Das Script muss mit Adminrechten und der Powershell ausgeführt werden.
*'''iex(iwr https://raw.githubusercontent.com/ansible/ansible-documentation/master/examples/scripts/ConfigureRemotingForAnsible.ps1)'''
 
*Nach dem Erfolgreichen Durchlauf des Scriptes sollte WinRM auf dem Port 5986 laufen.
*Nach dem Erfolgreichen Durchlauf des Scriptes sollte WinRM auf dem Port 5986 laufen.
netstat -anp|findstr 5986
*'''netstat -an | findstr 5986'''


=Ansible Rechner=
=Ansible Rechner=
==Installation==
==Installation==
*Installation des Python3 Packetes Pywinrm mit dem Packetmanager pip
*Installation des Python3 Packetes Pywinrm mit dem Packetmanager pip
pip3 install pywinrm
*'''pip3 install pywinrm'''
* Kontrolle ob die Verbindung zum Windows Host funktioniert
* Kontrolle ob die Verbindung zum Windows Host funktioniert
nc -w 3 -v <remote windows server ip/hostname> 5986
*'''nc -w 3 -v <remote windows server ip/hostname> 5986'''
(or)
*oder
telnet <remote windows server ip/hostname>:5986
*'''telnet <remote windows server ip/hostname>:5986'''


==Ansible Hosts Inventory File==
==Ansible Hosts Inventory File==
===Connect Parameter===
===Connect Parameter===
*ansible_connection=winrm to define the connection is not SSH should use winrm
*''ansible_connection'' sollte winrm sein statt SSH
*ansible_user what ever the username you have created in the windows machine
*''ansible_user'' what ever the username you have created in the windows machine
*ansible_password password for that user ( the same one you use for RDP)
*''ansible_password'' password for that user ( the same one you use for RDP)
*ansible_winrm_server_cert_validation this is fine in DEV/TEST environment to tell ansible to ignore hostkey/server cert validation.
*''ansible_winrm_server_cert_validation'' this is fine in DEV/TEST environment to tell ansible to ignore hostkey/server cert validation.
 
====Host Inventory File====
*[[Windows Host Inventory File]]


====Beispiel Host File====
=Tests=
[win]
*[[ansible-win-ping]]
192.9.12.122
*[[ansible-win-facts]]
[win:vars]
=Working=
ansible_connection=winrm
*[[ansible windows collection]]
ansible_user=administrator
ansible_password=r$eBQNgc5U&A2at8kDwpWo.KzLT5NvHd
ansible_winrm_server_cert_validation=ignore


==Ansible Script==
=Ansible Skript=
*Viele der Linux Befehle funktionieren unter Windows nicht, für die meisten Anforderungen gibt es Windows Äquivalente
*Viele der Linux Befehle funktionieren unter Windows nicht, für die meisten Anforderungen gibt es Windows Äquivalente
  https://github.com/ansible-collections/ansible.windows
  https://github.com/ansible-collections/ansible.windows
=Links=
=Links=
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#host-variables
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#host-variables
Zeile 59: Zeile 60:


https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html?extIdCarryOver=true&sc_cid=701f2000001OH7YAAW#host-requirements.
https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html?extIdCarryOver=true&sc_cid=701f2000001OH7YAAW#host-requirements.
https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html#configuring-ansible-for-ssh-on-windows

Aktuelle Version vom 27. Juni 2024, 12:11 Uhr

Host

Mindest Anforderungen

Windows Version

  • Windows 7
  • Windows 8.1
  • Windows 10
  • Windows Server 2008
  • Windows Server 2008
  • Windows Server R2
  • Windows Server 2012
  • Windows Server 2016
  • Windows Server 2019

Software

  • PowerShell 3.0
  • .NET 4.0
  • WinRM

Install WinRM

  • Nach dem Erfolgreichen Durchlauf des Scriptes sollte WinRM auf dem Port 5986 laufen.
  • netstat -an | findstr 5986

Ansible Rechner

Installation

  • Installation des Python3 Packetes Pywinrm mit dem Packetmanager pip
  • pip3 install pywinrm
  • Kontrolle ob die Verbindung zum Windows Host funktioniert
  • nc -w 3 -v <remote windows server ip/hostname> 5986
  • oder
  • telnet <remote windows server ip/hostname>:5986

Ansible Hosts Inventory File

Connect Parameter

  • ansible_connection sollte winrm sein statt SSH
  • ansible_user what ever the username you have created in the windows machine
  • ansible_password password for that user ( the same one you use for RDP)
  • ansible_winrm_server_cert_validation this is fine in DEV/TEST environment to tell ansible to ignore hostkey/server cert validation.

Host Inventory File

Tests

Working

Ansible Skript

  • Viele der Linux Befehle funktionieren unter Windows nicht, für die meisten Anforderungen gibt es Windows Äquivalente
https://github.com/ansible-collections/ansible.windows

Links

https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#host-variables

https://www.middlewareinventory.com/blog/how-to-use-ansible-with-windows-host-ansible-windows-example/

https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html?extIdCarryOver=true&sc_cid=701f2000001OH7YAAW#host-requirements.

https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html#configuring-ansible-for-ssh-on-windows