Ansible-local is not install software

23 views
Skip to first unread message

Adam Dallis

unread,
Aug 22, 2018, 11:26:17 AM8/22/18
to Packer
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

Rickard von Essen

unread,
Aug 22, 2018, 11:29:48 AM8/22/18
to packe...@googlegroups.com
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.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/fe206438-8b3b-4851-bdbe-111dc1872a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Dallis

unread,
Aug 22, 2018, 12:34:51 PM8/22/18
to Packer
Hi,
thanks for your reply.
I have uploaded my code to github here is the link


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
Ansibleresult.png
vimNotfound.png

Rickard von Essen

unread,
Aug 22, 2018, 12:44:30 PM8/22/18
to packe...@googlegroups.com
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.

AdamD

unread,
Aug 22, 2018, 4:49:35 PM8/22/18
to Packer
So you are suggesting I am running another box?

AdamD

unread,
Aug 22, 2018, 6:16:47 PM8/22/18
to Packer
that worked but can you please explain to me what is happening, why the vagrant up is not running the right box?

JP Toto

unread,
Aug 22, 2018, 8:09:10 PM8/22/18
to packe...@googlegroups.com
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.


For more options, visit https://groups.google.com/d/optout.


--
JP Toto   |   james....@gmail.com   |   http://jptoto.jp   |   @jptoto
Reply all
Reply to author
Forward
0 new messages