Detailed examples of how to use Ansible applications under Windows

黄舟
Release: 2017-06-07 09:34:37
Original
3316 people have browsed it

Environment requirements:

* Controller must be Linux

* Windows Requirements:

1.Framework 4.5

2.PowerShell 3.0

Materials:

Ansible Master (CentOS)

Anisble Slave (Windows SP1)

Steps:

[Linux ]

yum -y install python-kerberos.x86_64 python2-winrm.noarch
Copy after login

[Windows]

Download Framework 4.5

http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe
Copy after login

Download PowerShell 3.0

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

After the installation is complete, it will restart once

Download Remoting Script for Ansible

https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
Copy after login

Run the script as an administrator

Open PowerShell as an administrator

winrm qc
Copy after login
Copy after login

The following error will appear

This In fact, it is not an error. You only need to change the network properties: switch the public network to the home network in the Network and Sharing Center

Execute again

winrm qc
Copy after login
Copy after login

Next, you need to enable Windows remote operation Related attributes:

winrm set winrm/config/service '@{AllowUnencrypted="true"}'
Copy after login
winrm set winrm/config/service/auth '@{Basic="true"}'
Copy after login

Above you can see that port 5985 is up

    netstat -ano | findstr 5985
Copy after login

Use ansible to test the windows host

cat /etc/ansible/hosts
Copy after login

[windows]

10.0.50.100 ansible_ssh_user="Administrator" ansible_ssh_pass="123456" ansible_ssh_port=5986 ansible_connection="winrm"
Copy after login

The above is the detailed content of Detailed examples of how to use Ansible applications under Windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!