I had the same issue. First it stopped working on my mac (brew upgrade must have upgraded it) and I couldn't reproduce it working on my PC as well. Nearly drove me crazy.
Thanks so much for the great problem description and also the solution! /Per On Saturday, 22 July 2017 11:11:41 UTC+1, Daniel Campailla wrote: > > Yep that worked straight away as I was on 1.0.3. Thanks for you quick > response. :) > > On Saturday, 22 July 2017 10:35:53 UTC+1, Rickard von Essen wrote: >> >> If you are on 1.0.3 you need to downgrade to 1.0.2 or build from master >> to use ansible. See https://github.com/hashicorp/packer/issues/5142 >> >> On Jul 22, 2017 11:28, "Rickard von Essen" <[email protected]> wrote: >> >>> Which version of Packer? >>> >>> On Jul 22, 2017 11:26, "Daniel Campailla" <[email protected]> wrote: >>> >>> I wonder if anyone could offer some support as this issue has been >>> driving me crazy for days. >>> >>> I can create AMIs fine from a local machine but when I try to run Packer >>> from an AWS instance it hangs when it starts to execute Ansible as below >>> and stays in that state indefinitely: >>> >>> >>> TASK [Gathering Facts] >>> ********************************************************* >>> >>> amazon-ebs: Using module file /usr/lib/python2.7/site-packages/ansible/ >>> modules/system/setup.py >>> >>> amazon-ebs: <127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: jenkins >>> >>> amazon-ebs: <127.0.0.1> SSH: EXEC ssh -o ForwardAgent=yes -o >>> ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o >>> Port=33468 -o 'IdentityFile="/tmp/ansible-key652774606"' -o >>> KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with- >>> mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o >>> User=jenkins -o ConnectTimeout=10 -o ControlPath=/var/lib/jenkins/. >>> ansible/cp/bc1ce89347 127.0.0.1 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"'' >>> >>> >>> I’ve tried opening another session on the same server and running the >>> SSH command above and it seems to log me in okay but I cannot do anything >>> else on the target system after the home directory appears as below: >>> >>> >>> /home/ec2-user >>> >>> >>> For information, I’m new to Packer and am using temporary keys generated >>> automatically generated by the package. In addition, I've tried running >>> Packer from other servers in AWS but all of them exhibit the same issue. >>> The OS we’re using is CentOS/RHEL and the template is as below (note I've >>> created a specific IAM role which as per Packer's recommendation on their >>> site): >>> >>> >>> "builders": [ >>> { >>> "type": "amazon-ebs", >>> "region": "{{user `aws_region`}}", >>> "source_ami": "{{user `aws_source_ami`}}", >>> "subnet_id": "{{user `aws_subnet_id` }}", >>> "security_group_id": "{{user `aws_sg_id` }}", >>> "instance_type": "{{user `aws_instance_type`}}", >>> "ssh_username": "{{user `aws_ssh_username`}}", >>> "ami_name": "{{user `project_name`}}-{{user >>> `server_type`}}-{{user `server_version`}}_{{timestamp}}", >>> "iam_instance_profile": "packer-iam-role", >>> "launch_block_device_mappings": [ >>> { >>> "device_name": "{{user `boot_device_name`}}", >>> "volume_size": "{{user `boot_device_size`}}", >>> "volume_type": "{{user `boot_volume_type`}}", >>> "delete_on_termination": "{{user >>> `boot_volume_delete_on_termination`}}" >>> } >>> ], >>> "tags": { >>> "Name": "{{user `project_name`}}-{{user >>> `server_type`}}-{{user `server_version`}}_{{user `ami_datestamp`}}", >>> "Service": "{{user `service_id`}}", >>> "PackerVersion": "{{user `packer_version`}}", >>> "AnsibleVersion": "{{user `ansible_version`}}" >>> } >>> } >>> ], >>> "provisioners": [ >>> { >>> "type": "ansible", >>> "playbook_file": "{{user `playbook_location`}}/{{user >>> `project_name`}}_{{user `server_type`}}_{{user `server_version`}}.yml", >>> "extra_arguments": [ >>> "-vvv" >>> ], >>> "ansible_env_vars": [ >>> "ANSIBLE_HOST_KEY_CHECKING=False", "ANSIBLE_SSH_ARGS='-o >>> ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s'" >>> ] >>> } >>> >>> >>> >>> Any help or guidance you could provide would be greatly appreciated, >>> thanks. >>> >>> -- >>> This mailing list is governed under the HashiCorp Community Guidelines - >>> https://www.hashicorp.com/community-guidelines.html. Behavior in >>> violation of those guidelines may result in your removal from this mailing >>> list. >>> >>> GitHub Issues: https://github.com/mitchellh/packer/issues >>> IRC: #packer-tool on Freenode >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Packer" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/packer-tool/1f3acd0f-b0e0-4857-9fe6-bcd5f415a911%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/packer-tool/1f3acd0f-b0e0-4857-9fe6-bcd5f415a911%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/718ec69e-da28-40ee-8c04-aa78e8709a00%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
