Ansible Windows Host: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K (Thomas.will verschob die Seite Windows Host nach Ansible Windows Host) |
|||
| Zeile 45: | Zeile 45: | ||
[win:vars] | [win:vars] | ||
ansible_connection=winrm | ansible_connection=winrm | ||
| − | ansible_user= | + | ansible_user=xinux |
| − | ansible_password= | + | ansible_password=123Start$ |
ansible_winrm_server_cert_validation=ignore | ansible_winrm_server_cert_validation=ignore | ||
Version vom 6. Februar 2023, 18:46 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
- Ansible Team stellt Script für Installation zur Verfügung
- Das Script muss mit Adminrechten und der Powershell ausgeführt werden.
iex(iwr https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1)
- Nach dem Erfolgreichen Durchlauf des Scriptes sollte WinRM auf dem Port 5986 laufen.
netstat -anp|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 (or) 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.
Beispiel Host File
[win] 192.9.12.122 [win:vars] ansible_connection=winrm ansible_user=xinux ansible_password=123Start$ ansible_winrm_server_cert_validation=ignore
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