My issue is now resolved. I ended up using a Ubuntu Trusty instance and
began creating AMI(s) in us-east-2 (Ohio) versus us-east-1. I did not have
a default VPC in us-east-1 and was unable to create one. Packer appears to
work much better when you do not specify the VPC or the subnet in the
Packer template. Frustrating but glad I'm now making progress. Thanks for
all the help :)
On Thursday, March 28, 2019 at 7:11:30 PM UTC-5, Erick K wrote:
>
> Thoroughly confused :(
>
> I have Packer and Ansible installed on an Amazon Linux EC2 instance. I am
> able to use Packer from that instance to create an Amazon Linux image.
>
> I am trying to configure the Ansible provisioner to install software on
> the image but don't have/or want to install Ansible on the image: ansible
> remote.
>
> My playbook is in the same directory as my Packer JSON file. I have not
> configured an inventory file because I don't know what IP address the IP
> address of the newly created image.
>
>
>
> - hosts: default
> gather_facts: True
> user: ec2-user
> sudo: True
>
> tasks:
> - name: "update"
> yum:
> name: httpd
> state: latest
>
>
>
>
>
> {
> "builders": [
> {
> "type": "amazon-ebs",
> "access_key": "XXX",
> "secret_key": "YYY",
> "region": "us-east-1",
> "source_ami": "ami-0de53d8956e8dcf80",
> "instance_type": "t2.micro",
> "ssh_username": "ec2-user",
> "ami_name": "packer-example {{timestamp}}",
> "vpc_id": "vpc-XXX",
> "subnet_id": "subnet-XXX"
> }
> ],
> "provisioners": [{
> "type": "ansible",
> "playbook_file": "./playbook.yml",
> "extra_arguments": "-vvvv",
> "user": "ec2-user",
> "host_alias": "default",
> "extra_arguments": ["-vvvv"],
> "ansible_env_vars": ["ANSIBLE_HOST_KEY_CHECKING=False"]
> }]
> }
>
>
>
>
>
>
>
--
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/524fe3c4-0431-40f0-b1f1-7ab5da0a219c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.