Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using Ansible applications under Windows

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Environmental requirements:

* Controller must be Linux

* Windows requires:

1.Framework 4.5

2.PowerShell 3.0

Raw materials:

Ansible Master (CentOS)

Anisble Slave (Windows SP1)

Steps:

[Linux]

Yum-y install python-kerberos.x86_64 python2-winrm.noarch

[Windows]

Download Framework 4.5

Http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe

Download PowerShell 3.0

Https://download.microsoft.com/download/E/7/6/E76850B8-DA6E-4FF5-8CCE-A24FC513FD16/Windows6.1-KB2506143-x64.msu

Restart once after the installation is complete

Download Remoting Script for Ansible

Https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

Run the script as an administrator

* if encountered: PowerShell because script execution is prohibited on this system

Execute:

Set-ExecutionPolicy RemoteSigned

Open PowerShell as an administrator

Winrm qc

The following error occurs

In fact, this is not a mistake, it is only required to change the properties of the network: switch the public network to the home network in the network and sharing center.

Execute again

Winrm qc

This time it should be successful, and the following picture will be displayed:

Next, you need to enable the relevant properties of the windows remote operation:

Winrm set winrm/config/service'@ {AllowUnencrypted= "true"} 'winrm set winrm/config/service/auth' @ {Basic= "true"}'

Above, you can see that port 5985 is up.

Netstat-ano | findstr 5985

Test the windows host using ansible

Cat / etc/ansible/ hosts [windows] 10.0.50.100 ansible_ssh_user= "Administrator" ansible_ssh_pass= "123456" ansible_ssh_port=5986 ansible_connection= "winrm"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report