Adam, When you create an image or a "box" using Packer, it will generate the finished artifact using the format of the builder and, depending on the builder you're using, either leave the artifact (box file) on the file system, or register it with, for example, the Azure image inventory. (If you used an Azure builder)
In your case, you're using the "hyperv-iso" builder which will leave a box file in which there is a disk file and metadata that HyperV will understand. However, since you want to run that newly generated artifact/box file with Vagrant, Vagrant first needs to know it exists. It was left on your file system but Vagrant needs to be told about it. So, when you "vagrant box add my-ubuntu <path to output .box from packer build>" per Rickard, that adds the box you generated to the Vagrant inventory. Then you can reference that box from any Vagrant file on your system and "vagrant up" and it'll use your newly generated box from the Vagrant inventory. On Wed, Aug 22, 2018 at 6:16 PM AdamD <[email protected]> wrote: > that worked but can you please explain to me what is happening, why the > vagrant up is not running the right box? > > On Wednesday, 22 August 2018 21:49:35 UTC+1, AdamD wrote: >> >> So you are suggesting I am running another box? >> >> On Wednesday, 22 August 2018 17:44:30 UTC+1, Rickard von Essen wrote: >>> >>> After packer build ubuntu.json >>> >>> you first need to do: vagrant box add my-ubuntu <path to output .box >>> from packer build> >>> >>> Then you can do: vagrant up >>> >>> But you need to change it so it reference "my-ubuntu" in config.vm.box. >>> >>> On Wed, 22 Aug 2018 at 18:34, Adam Dallis <[email protected]> wrote: >>> >>>> Hi, >>>> thanks for your reply. >>>> I have uploaded my code to github here is the link >>>> >>>> https://github.com/adamdallis/Packer-ansible-ubuntu18.04VM >>>> >>>> I execute >>>> >>>> packer build ubuntu.json >>>> >>>> and during the setup i can see that ansible changed something see >>>> ansibleresult.png. >>>> >>>> then i do vagrant up >>>> >>>> then i ssh into the box >>>> >>>> and see vimnotfound.png >>>> >>>> >>>> I appreciate your help >>>> Adam >>>> >>>> >>>> On Wednesday, 22 August 2018 16:29:48 UTC+1, Rickard von Essen wrote: >>>>> >>>>> Most likely there is a flaw in your workflow. Show us the template you >>>>> are building and exactly which commands you run and what you do to inspect >>>>> the result. >>>>> >>>>> On Wed, 22 Aug 2018 at 17:26, Adam Dallis <[email protected]> >>>>> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> i am fairly new to the world of packer and ansible, I have created a >>>>>> template that installs fine I can see in the console that ansible-local >>>>>> has >>>>>> made changes but when I ssh into the box the software is missing that >>>>>> should have been installed by ansible. >>>>>> >>>>>> Any advice would be appreciated. >>>>>> >>>>>> >>>>>> Regards, >>>>>> Adam >>>>>> >>>>>> -- >>>>>> 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/fe206438-8b3b-4851-bdbe-111dc1872a47%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/packer-tool/fe206438-8b3b-4851-bdbe-111dc1872a47%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/bf4f68f0-c52d-4991-bb45-6f73b5335cfe%40googlegroups.com >>>> <https://groups.google.com/d/msgid/packer-tool/bf4f68f0-c52d-4991-bb45-6f73b5335cfe%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/e2fe3983-08d7-4953-9027-11af187087b5%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/e2fe3983-08d7-4953-9027-11af187087b5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- JP Toto | [email protected] | http://jptoto.jp | @jptoto <http://twitter.com/jptoto> -- 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/CAAYNrX_dSBoBdsUCUpDQ_EV_Tf8E4Ef2%2BvhBcTxTmSJhjk12yQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
