Ansible 通过 WinRM 连接但挂在第一步

Ansible connects via WinRM but hangs on first step

我正在尝试使用 Packer,将 Ansible 作为配置器,来构建一个 Windows AMI。

$ packer --version 1.0.3

$ ansible --version ansible 2.2.0.0

Ansible 似乎连接成功,但随后挂在剧本的第一步,下载 7zip。下面是我的 Packer 模板和 Ansible playook 示例。

打包机

{
"builders": [{
    "type": "amazon-ebs",
    "region": "us-west-2",
    "source_ami": "ami-09f47d69",
    "instance_type": "m4.large",
    "ami_name": "Packer windows test",
    "user_data_file": "./scripts/ec2bootstrap.ps1",

    "communicator": "winrm",
    "winrm_username": "Administrator"
}],

"provisioners": [
    {
        "type": "powershell",
        "scripts": [
          "./scripts/ec2config.ps1",
          "./scripts/bundleconfig.ps1"
        ]
    },

    {
        "type": "ansible",
        "playbook_file": "../ansible/base_ami_site.yml",
        "extra_arguments": [
             "--connection", "packer",
             "--extra-vars", "ansible_shell_type=powershell ansible_shell_executable=None -vvvv"    
        ]

}]}

Ansible 示例

- name: Download 7-Zip Installer
win_get_url:
url: http://www.7-zip.org/a/7z1604-x64.msi
dest: C:\Users\Administrator\Downloads-zip.msi
force: no

重申一下,它确实连接了,但没有运行。

原来加壳版本 1.0.3 阻止了 ansible 的成功 运行。