Trying to use ansible as a provisioner in packer. Ansible is hanging during the TASK [Gathering Facts] and I have no idea why
the provisioner snippet is below:
{
"type": "ansible",
"command": "script/ansible.sh",
"playbook_file": "playbooks/testing_ami.yml",
"user": "{{ user `ssh_username` }}",
"groups": [
"aws_comap_com",
"linux_servers"
],
"extra_arguments": [
"-u ubuntu",
"-vvvv"
],
"only": [
"amazon-ebs"
]
}
The testing_ami.yml is below:
- hosts: all
vars:
keep_deb_src: true
keep_build_essentials: true
pre_tasks:
roles:
- { role: take-over, become: yes }
tasks:
post_tasks:
The script/ansible.sh
#!/bin/bash
ansible-playbook $@
I do not understand why a couple of the ssh calls to the packer AMI work and then last one fails.
I am pretty sure this is a packer problem as invoking the same playbook from the command line
works as expected. BUT the logs show the invocation of ansible-playbook like I would do via the command
line.
When I "telnet 127.0.0.1 port", where port is show in the gist below I see
$ telnet localhost 58595
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-Go
So Packer (Go) is being a proxy to the Packer AMI but I never see any sort of login attempts in /var/log/syslog on the Packer AMI then I try to "ssh 127.0.0.1 port"
gist of the logs