Re: [packer] "The box you attempted to add doesn't match the provider you specified", Packer + AWS + VirtualBox

2016-10-16 Thread Miguel David
Thank you for clarifying Rickard. I will add the virtual box builder then.

--
Miguel
https://www.migueldavid.eu

On 16 Oct 2016 3:16 p.m., "Rickard von Essen" 
wrote:

> Sorry I read to fast.
>
> I understand that the original box was built using AWS's builder from
>> packer, but the postprocessor should generate a vagrant/Virtualbox friendly
>> box, right?
>
>
> The *vagrant *post-processor does not convert the underlying format. So
> *amazon-ebs* builder together with the *vagrant *post-porocessor creates
> vagrant boxes for the *aws *vagrant provider. If you want a (standard)
> *virtualbox* vagrant provider box you need to run one of the *virtualbox 
> *builders
> in packer.
>
> Hope that clarifies it.
>
> On 16 October 2016 at 12:42, Miguel David  wrote:
>
>> Hi Rickard,
>>
>> Thanks for replying. When I tried stating that the provider was aws, it
>> goes out and uses the vagrant-aws plugin to create the instance on aws. Am
>> I misunderstanding something here?
>>
>> Again, thank you for any assistance.
>>
>> --
>> Miguel
>> https://www.migueldavid.eu
>>
>> On 16 Oct 2016 7:33 a.m., "Rickard von Essen" <
>> rickard.von.es...@gmail.com> wrote:
>>
>>> I think everthing is working except that you try to start the default
>>> provider, virtualbox in vagrant when you do:
>>> $ vagrant up
>>> Bringing machine 'default' up with 'virtualbox' provider...
>>>
>>> Try:
>>> $ vagrant up --provider=aws
>>>
>>> On 16 October 2016 at 02:38, Miguel David  wrote:
>>>
 Hi,

 Firstly apologies if this came up already. I was not able to find it
 with Google searches.
 This is a packer-vagrant mixed issue, so I know that it could be also
 in vagrant's group.

 What I am trying to do is to use packer to create an AWS instance,
 provision it (with ansible), generate an AWS AMI and post-processing would
 generate a vagrant box.
 The whole process runs smoothly, but when I try to vagrant up that box
 I get "The box you attempted to add doesn't match the provider you
 specified.".

 Here is the relevant code from packer's json:

 {
   "variables": {
 ...
   },
   "builders": [
 {
   "type": "amazon-ebs",
   "access_key": "{{user `aws_access_key`}}",
   "secret_key": "{{user `aws_secret_key`}}",
   "region": "{{user `region`}}",
   "source_ami": "{{user `source_ami`}}",
   "instance_type": "{{user `size`}}",
   "ssh_username": "{{user `user`}}",
   "ami_name": "{{user `temp_box`}}",
   "ami_description": "{{user `ami_desc`}}",
   "ami_regions": [
 "eu-west-1",
 "eu-central-1"
   ],
   "associate_public_ip_address": true,
   "force_deregister": true,
   "run_tags": {
 "type": "packertempinstance"
   },
   "tags": {
 "type": "packerimage",
 "tag2": "stuff"
   },
   "temporary_key_pair_name": "{{user `tmp_keypair`}}"
 }
   ],
   "provisioners": [
 {
   "type": "shell",
   "inline": [
 "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo
 'Waiting for cloud-init...'; sleep 1; done"
   ]
 },
 {
   "type": "shell",
   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
 '{{.Path}}'",
   "inline": ["apt install python-minimal aptitude -y"]
 },
 {
   "type": "ansible",
   "playbook_file": "./playbook.yml",
   "groups": ["all", "app"],
   "ssh_host_key_file": "/Users/myuser/.ssh/mykey.pem",
   "extra_arguments": "-v",
   "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
 },
 {
   "type": "shell",
   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
 '{{.Path}}'",
   "script": "cleanup.sh"
 }
   ],
   "post-processors": [
 {
   "type": "vagrant",
   "keep_input_artifact": true,
   "output": "modified-xenial.box"
 }
   ]
 }

 When the modified-xenial.box is generated I'm adding it as a box:
 # vagrant box add mybox `pwd`/modified-xenial.box
 And then:
 # vagrant init mybox -m

 At this point I have a Vagrantfile like this:

 $ cat Vagrantfile
 Vagrant.configure("2") do |config|
   config.vm.box = "mybox"
   config.vm.box_url = ["file:///Users/myuser/Dev/modified-xenial.box"]
 end

 However, when I vagrant up it I get this:

 $ vagrant up
 Bringing machine 'default' up with 'virtualbox' provider...
 ==> default: Box 'mybox' could not be found. Attempting to find and
 install...
 default: Box Provider: virtualbox
 default: Box Version: >= 0
 ==> default: Box file was not detected as metadata. Adding it
 directly...
 ==> defaul

Re: [packer] "The box you attempted to add doesn't match the provider you specified", Packer + AWS + VirtualBox

2016-10-16 Thread Rickard von Essen
Sorry I read to fast.

I understand that the original box was built using AWS's builder from
> packer, but the postprocessor should generate a vagrant/Virtualbox friendly
> box, right?


The *vagrant *post-processor does not convert the underlying format. So
*amazon-ebs* builder together with the *vagrant *post-porocessor creates
vagrant boxes for the *aws *vagrant provider. If you want a (standard)
*virtualbox* vagrant provider box you need to run one of the
*virtualbox *builders
in packer.

Hope that clarifies it.

On 16 October 2016 at 12:42, Miguel David  wrote:

> Hi Rickard,
>
> Thanks for replying. When I tried stating that the provider was aws, it
> goes out and uses the vagrant-aws plugin to create the instance on aws. Am
> I misunderstanding something here?
>
> Again, thank you for any assistance.
>
> --
> Miguel
> https://www.migueldavid.eu
>
> On 16 Oct 2016 7:33 a.m., "Rickard von Essen" 
> wrote:
>
>> I think everthing is working except that you try to start the default
>> provider, virtualbox in vagrant when you do:
>> $ vagrant up
>> Bringing machine 'default' up with 'virtualbox' provider...
>>
>> Try:
>> $ vagrant up --provider=aws
>>
>> On 16 October 2016 at 02:38, Miguel David  wrote:
>>
>>> Hi,
>>>
>>> Firstly apologies if this came up already. I was not able to find it
>>> with Google searches.
>>> This is a packer-vagrant mixed issue, so I know that it could be also in
>>> vagrant's group.
>>>
>>> What I am trying to do is to use packer to create an AWS instance,
>>> provision it (with ansible), generate an AWS AMI and post-processing would
>>> generate a vagrant box.
>>> The whole process runs smoothly, but when I try to vagrant up that box I
>>> get "The box you attempted to add doesn't match the provider you
>>> specified.".
>>>
>>> Here is the relevant code from packer's json:
>>>
>>> {
>>>   "variables": {
>>> ...
>>>   },
>>>   "builders": [
>>> {
>>>   "type": "amazon-ebs",
>>>   "access_key": "{{user `aws_access_key`}}",
>>>   "secret_key": "{{user `aws_secret_key`}}",
>>>   "region": "{{user `region`}}",
>>>   "source_ami": "{{user `source_ami`}}",
>>>   "instance_type": "{{user `size`}}",
>>>   "ssh_username": "{{user `user`}}",
>>>   "ami_name": "{{user `temp_box`}}",
>>>   "ami_description": "{{user `ami_desc`}}",
>>>   "ami_regions": [
>>> "eu-west-1",
>>> "eu-central-1"
>>>   ],
>>>   "associate_public_ip_address": true,
>>>   "force_deregister": true,
>>>   "run_tags": {
>>> "type": "packertempinstance"
>>>   },
>>>   "tags": {
>>> "type": "packerimage",
>>> "tag2": "stuff"
>>>   },
>>>   "temporary_key_pair_name": "{{user `tmp_keypair`}}"
>>> }
>>>   ],
>>>   "provisioners": [
>>> {
>>>   "type": "shell",
>>>   "inline": [
>>> "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo
>>> 'Waiting for cloud-init...'; sleep 1; done"
>>>   ]
>>> },
>>> {
>>>   "type": "shell",
>>>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
>>> '{{.Path}}'",
>>>   "inline": ["apt install python-minimal aptitude -y"]
>>> },
>>> {
>>>   "type": "ansible",
>>>   "playbook_file": "./playbook.yml",
>>>   "groups": ["all", "app"],
>>>   "ssh_host_key_file": "/Users/myuser/.ssh/mykey.pem",
>>>   "extra_arguments": "-v",
>>>   "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
>>> },
>>> {
>>>   "type": "shell",
>>>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
>>> '{{.Path}}'",
>>>   "script": "cleanup.sh"
>>> }
>>>   ],
>>>   "post-processors": [
>>> {
>>>   "type": "vagrant",
>>>   "keep_input_artifact": true,
>>>   "output": "modified-xenial.box"
>>> }
>>>   ]
>>> }
>>>
>>> When the modified-xenial.box is generated I'm adding it as a box:
>>> # vagrant box add mybox `pwd`/modified-xenial.box
>>> And then:
>>> # vagrant init mybox -m
>>>
>>> At this point I have a Vagrantfile like this:
>>>
>>> $ cat Vagrantfile
>>> Vagrant.configure("2") do |config|
>>>   config.vm.box = "mybox"
>>>   config.vm.box_url = ["file:///Users/myuser/Dev/modified-xenial.box"]
>>> end
>>>
>>> However, when I vagrant up it I get this:
>>>
>>> $ vagrant up
>>> Bringing machine 'default' up with 'virtualbox' provider...
>>> ==> default: Box 'mybox' could not be found. Attempting to find and
>>> install...
>>> default: Box Provider: virtualbox
>>> default: Box Version: >= 0
>>> ==> default: Box file was not detected as metadata. Adding it directly...
>>> ==> default: Adding box 'mybox' (v0) for provider: virtualbox
>>> default: Unpacking necessary files from:
>>> file:///Users/myuser/Dev/modified-xenial.box
>>> The box you attempted to add doesn't match the provider you specified.
>>>
>>> Provider expected: virtualbox
>>> Provider of box: aws
>>>
>>> I understand that the original box was built using AWS's builder from

Re: [packer] "The box you attempted to add doesn't match the provider you specified", Packer + AWS + VirtualBox

2016-10-16 Thread Miguel David
Hi Rickard,

Thanks for replying. When I tried stating that the provider was aws, it
goes out and uses the vagrant-aws plugin to create the instance on aws. Am
I misunderstanding something here?

Again, thank you for any assistance.

--
Miguel
https://www.migueldavid.eu

On 16 Oct 2016 7:33 a.m., "Rickard von Essen" 
wrote:

> I think everthing is working except that you try to start the default
> provider, virtualbox in vagrant when you do:
> $ vagrant up
> Bringing machine 'default' up with 'virtualbox' provider...
>
> Try:
> $ vagrant up --provider=aws
>
> On 16 October 2016 at 02:38, Miguel David  wrote:
>
>> Hi,
>>
>> Firstly apologies if this came up already. I was not able to find it with
>> Google searches.
>> This is a packer-vagrant mixed issue, so I know that it could be also in
>> vagrant's group.
>>
>> What I am trying to do is to use packer to create an AWS instance,
>> provision it (with ansible), generate an AWS AMI and post-processing would
>> generate a vagrant box.
>> The whole process runs smoothly, but when I try to vagrant up that box I
>> get "The box you attempted to add doesn't match the provider you
>> specified.".
>>
>> Here is the relevant code from packer's json:
>>
>> {
>>   "variables": {
>> ...
>>   },
>>   "builders": [
>> {
>>   "type": "amazon-ebs",
>>   "access_key": "{{user `aws_access_key`}}",
>>   "secret_key": "{{user `aws_secret_key`}}",
>>   "region": "{{user `region`}}",
>>   "source_ami": "{{user `source_ami`}}",
>>   "instance_type": "{{user `size`}}",
>>   "ssh_username": "{{user `user`}}",
>>   "ami_name": "{{user `temp_box`}}",
>>   "ami_description": "{{user `ami_desc`}}",
>>   "ami_regions": [
>> "eu-west-1",
>> "eu-central-1"
>>   ],
>>   "associate_public_ip_address": true,
>>   "force_deregister": true,
>>   "run_tags": {
>> "type": "packertempinstance"
>>   },
>>   "tags": {
>> "type": "packerimage",
>> "tag2": "stuff"
>>   },
>>   "temporary_key_pair_name": "{{user `tmp_keypair`}}"
>> }
>>   ],
>>   "provisioners": [
>> {
>>   "type": "shell",
>>   "inline": [
>> "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo
>> 'Waiting for cloud-init...'; sleep 1; done"
>>   ]
>> },
>> {
>>   "type": "shell",
>>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
>> '{{.Path}}'",
>>   "inline": ["apt install python-minimal aptitude -y"]
>> },
>> {
>>   "type": "ansible",
>>   "playbook_file": "./playbook.yml",
>>   "groups": ["all", "app"],
>>   "ssh_host_key_file": "/Users/myuser/.ssh/mykey.pem",
>>   "extra_arguments": "-v",
>>   "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
>> },
>> {
>>   "type": "shell",
>>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
>> '{{.Path}}'",
>>   "script": "cleanup.sh"
>> }
>>   ],
>>   "post-processors": [
>> {
>>   "type": "vagrant",
>>   "keep_input_artifact": true,
>>   "output": "modified-xenial.box"
>> }
>>   ]
>> }
>>
>> When the modified-xenial.box is generated I'm adding it as a box:
>> # vagrant box add mybox `pwd`/modified-xenial.box
>> And then:
>> # vagrant init mybox -m
>>
>> At this point I have a Vagrantfile like this:
>>
>> $ cat Vagrantfile
>> Vagrant.configure("2") do |config|
>>   config.vm.box = "mybox"
>>   config.vm.box_url = ["file:///Users/myuser/Dev/modified-xenial.box"]
>> end
>>
>> However, when I vagrant up it I get this:
>>
>> $ vagrant up
>> Bringing machine 'default' up with 'virtualbox' provider...
>> ==> default: Box 'mybox' could not be found. Attempting to find and
>> install...
>> default: Box Provider: virtualbox
>> default: Box Version: >= 0
>> ==> default: Box file was not detected as metadata. Adding it directly...
>> ==> default: Adding box 'mybox' (v0) for provider: virtualbox
>> default: Unpacking necessary files from:
>> file:///Users/myuser/Dev/modified-xenial.box
>> The box you attempted to add doesn't match the provider you specified.
>>
>> Provider expected: virtualbox
>> Provider of box: aws
>>
>> I understand that the original box was built using AWS's builder from
>> packer, but the postprocessor should generate a vagrant/Virtualbox friendly
>> box, right?
>>
>> Any help into what I am doing wrong is appreciated.
>>
>> Cheers,
>> Miguel
>>
>> --
>> 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 packer-tool+unsubscr

Re: [packer] "The box you attempted to add doesn't match the provider you specified", Packer + AWS + VirtualBox

2016-10-15 Thread Rickard von Essen
I think everthing is working except that you try to start the default
provider, virtualbox in vagrant when you do:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...

Try:
$ vagrant up --provider=aws

On 16 October 2016 at 02:38, Miguel David  wrote:

> Hi,
>
> Firstly apologies if this came up already. I was not able to find it with
> Google searches.
> This is a packer-vagrant mixed issue, so I know that it could be also in
> vagrant's group.
>
> What I am trying to do is to use packer to create an AWS instance,
> provision it (with ansible), generate an AWS AMI and post-processing would
> generate a vagrant box.
> The whole process runs smoothly, but when I try to vagrant up that box I
> get "The box you attempted to add doesn't match the provider you
> specified.".
>
> Here is the relevant code from packer's json:
>
> {
>   "variables": {
> ...
>   },
>   "builders": [
> {
>   "type": "amazon-ebs",
>   "access_key": "{{user `aws_access_key`}}",
>   "secret_key": "{{user `aws_secret_key`}}",
>   "region": "{{user `region`}}",
>   "source_ami": "{{user `source_ami`}}",
>   "instance_type": "{{user `size`}}",
>   "ssh_username": "{{user `user`}}",
>   "ami_name": "{{user `temp_box`}}",
>   "ami_description": "{{user `ami_desc`}}",
>   "ami_regions": [
> "eu-west-1",
> "eu-central-1"
>   ],
>   "associate_public_ip_address": true,
>   "force_deregister": true,
>   "run_tags": {
> "type": "packertempinstance"
>   },
>   "tags": {
> "type": "packerimage",
> "tag2": "stuff"
>   },
>   "temporary_key_pair_name": "{{user `tmp_keypair`}}"
> }
>   ],
>   "provisioners": [
> {
>   "type": "shell",
>   "inline": [
> "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo
> 'Waiting for cloud-init...'; sleep 1; done"
>   ]
> },
> {
>   "type": "shell",
>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
> '{{.Path}}'",
>   "inline": ["apt install python-minimal aptitude -y"]
> },
> {
>   "type": "ansible",
>   "playbook_file": "./playbook.yml",
>   "groups": ["all", "app"],
>   "ssh_host_key_file": "/Users/myuser/.ssh/mykey.pem",
>   "extra_arguments": "-v",
>   "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
> },
> {
>   "type": "shell",
>   "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash
> '{{.Path}}'",
>   "script": "cleanup.sh"
> }
>   ],
>   "post-processors": [
> {
>   "type": "vagrant",
>   "keep_input_artifact": true,
>   "output": "modified-xenial.box"
> }
>   ]
> }
>
> When the modified-xenial.box is generated I'm adding it as a box:
> # vagrant box add mybox `pwd`/modified-xenial.box
> And then:
> # vagrant init mybox -m
>
> At this point I have a Vagrantfile like this:
>
> $ cat Vagrantfile
> Vagrant.configure("2") do |config|
>   config.vm.box = "mybox"
>   config.vm.box_url = ["file:///Users/myuser/Dev/modified-xenial.box"]
> end
>
> However, when I vagrant up it I get this:
>
> $ vagrant up
> Bringing machine 'default' up with 'virtualbox' provider...
> ==> default: Box 'mybox' could not be found. Attempting to find and
> install...
> default: Box Provider: virtualbox
> default: Box Version: >= 0
> ==> default: Box file was not detected as metadata. Adding it directly...
> ==> default: Adding box 'mybox' (v0) for provider: virtualbox
> default: Unpacking necessary files from: file:///Users/myuser/Dev/modif
> ied-xenial.box
> The box you attempted to add doesn't match the provider you specified.
>
> Provider expected: virtualbox
> Provider of box: aws
>
> I understand that the original box was built using AWS's builder from
> packer, but the postprocessor should generate a vagrant/Virtualbox friendly
> box, right?
>
> Any help into what I am doing wrong is appreciated.
>
> Cheers,
> Miguel
>
> --
> 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 packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/2a370330-e773-4fe3-8e34-c4e8991b14e4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.