Sorry for multiposting. No one response from Packer Community Forum.
I will update Packer Community Forum post if I received solution here.
I have created my Vagrantfile below
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 5901, host: 5901
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = "2560"
endend
I want to use this Vagrantfile for created box.
My packer template JSON file is below
packer_template.json
{
"builders": [
{
"communicator": "ssh",
"source_path": "bento/ubuntu-18.04",
"provider": "virtualbox",
"type": "vagrant",
"output_vagrantfile": "Vagrantfile"
}
],
"provisioners": [
{
"type": "shell",
"script": "packer_script.sh"
},
{
"type": "ansible-local",
"playbook_file": "site.yml",
"playbook_dir": "."
}
]
}
Run packer build packer_template.json. This result is created
output-vagrant directory.
This directory included Vagrantfile below
Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|
source.vm.box = "bento/ubuntu-18.04"
config.ssh.insert_key = false
end
config.vm.define "output" do |output|
output.vm.box = "packer_vagrant"
output.vm.box_url = "file://package.box"
config.ssh.insert_key = false
end
config.vm.synced_folder ".", "/vagrant", disabled: trueend
So, executing vagrant up is launch output VM.
Then vagrant ssh result is This command requires a specific VM name to
target in a multi-VM environment..
I’m using Packer v1.6.0.
Question:
1. I want to vagrant up -> vagrant ssh without specify VM name.
2. I want to use my Vagrantfile instead of the defined source and output
VM.
How to?
Am I wrong?
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/hashicorp/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/c40d1f1e-2c92-4f9e-b81d-c1e1160ff94fo%40googlegroups.com.