[英]How to connect to a Windows EC2 instance using Ansible?
From reading the Connect to your Windows instance AWS EC2 docs page, my understanding is that it is not possible to SSH to Windows EC2 instances.通过阅读连接到您的 Windows 实例AWS EC2 文档页面,我的理解是无法通过 SSH 连接到 Windows EC2 实例。
The typical procedure to connect to a Windows EC2 instance manually is to download the remote desktop file, get the password for the instance, and then use the Remote Desktop Connection tool to RDP to the instance (more detail is in the docs page above).手动连接到 Windows EC2 实例的典型过程是下载远程桌面文件,获取实例的密码,然后使用远程桌面连接工具 RDP 到实例(更多详细信息在上面的文档页面中)。
If I am correct that Windows EC2 instances do not support connecting via SSH, how can you connect to a Windows EC2 in an Ansible playbook?如果我认为 Windows EC2 实例不支持通过 SSH 连接是正确的,那么如何在 Ansible playbook 中连接到 Windows EC2?
I would prefer to be able to do this without installing any software on the Windows EC2 instance beforehand, but if that is necessary, I can do that.我希望能够在不事先在 Windows EC2 实例上安装任何软件的情况下执行此操作,但如果有必要,我可以这样做。
I have found you need to do the following to connect to a Windows EC2 instance using Ansible:我发现您需要执行以下操作才能使用 Ansible 连接到 Windows EC2 实例:
ConfigureRemotingForAnsible.ps1
script .ConfigureRemotingForAnsible.ps1
脚本将 EC2 配置为允许来自 Ansible 的连接。 This can be done either by setting this as the user data when you create the EC2, or by running this script after the EC2 is created.ansible_connection
variable set to winrm
, and the ansible_winrm_scheme
variable set to http
.ansible_connection
变量设置为winrm
,并将ansible_winrm_scheme
变量设置为http
。 This can be done with --extra-args
or any other way that variables are set.--extra-args
或任何其他设置变量的方式来完成。hosts
in the playbook, or in a host file passed to ansible-playbook
with -i
.hosts
下,或者在使用-i
传递给ansible-playbook
的主机文件中。ansible_password
variable for the EC2.ansible_password
变量一起提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.