Reputation: 51
I am trying to use Packer, with Ansible as a provisioner, to build a Windows AMI.
$ packer --version
1.0.3
$ ansible --version
ansible 2.2.0.0
Ansible seems to connect successfully, but then hangs at the first step in the playbook, downloading 7zip. Below are my Packer template and a sample of the Ansible playook.
Packer
{
"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 sample
- 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
Just to reiterate, it does connect, but nothing runs.
Upvotes: 0
Views: 610
Reputation: 51
Turns out packer version 1.0.3
was preventing ansible from successfully being run.
Upvotes: 1