2.6.2 ansible windows安装
http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe




最后更新于
http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe




最后更新于
PS C:\Users\Administrator> get-host
Name : ConsoleHost
Version : 2.0
InstanceId : a664faa2-3825-46c4-8869-312eb849add7
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : zh-CN
CurrentUICulture : zh-CN
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspacePS C:\Users\Administrator> set-executionpolicy remotesigned
执行策略更改
执行策略可以防止您执行不信任的脚本。更改执行策略可能会使您面临 about_Execution_Policies
帮助主题中所述的安全风险。是否要更改执行策略?
[Y] 是(Y) [N] 否(N) [S] 挂起(S) [?] 帮助 (默认值为“Y”): Yhttps://raw.githubusercontent.com/cchurch/ansible/devel/examples/scripts/upgrade_to_ps3.ps1PS D:\> get-host
Name : ConsoleHost
Version : 3.0
InstanceId : 4bd1de40-3406-459d-bb06-4aa62e8e13be
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : zh-CN
CurrentUICulture : zh-CN
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspacehttps://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1PS D:\> winrm qc
已在此计算机上运行 WinRM 服务。
在此计算机上设置了 WinRM 以进行远程管理。
PS D:\> winrm set winrm/config/service '@{AllowUnencrypted="true"}' #配置验证
Service
RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = true
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *
IPv6Filter = *
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
AllowRemoteAccess = true
PS D:\> winrm set winrm/config/service/auth '@{Basic="true"}' #配置加密方式为允许非加密
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxedhttps://raw.githubusercontent.com/jborean93/ansible-windows/master/scripts/Install-WMF3Hotfix.ps1[root@autodeploy playbooks]# pip install pywinrm[root@autodeploy playbooks]# cat /etc/ansible/hosts
[windows]
192.168.1.102
[windows:vars]
ansible_user='Administrator'
ansible_password="abcABC123"
ansible_ssh_port=5985
ansible_connection='winrm'
ansible_winrm_server_cert_validation=ignore
[root@autodeploy playbooks]# ansible windows -m win_ping
192.168.1.102 | SUCCESS => {
"changed": false,
"ping": "pong"
}