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

时间:2017-07-31 18:34:24

标签: ansible packer

我正在尝试使用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\7-zip.msi
force: no

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

1 个答案:

答案 0 :(得分:1)

原封包版本1.0.3阻止了ansible成功运行。