Im trying to distribute a packaged base box and I want to use one of my existing servers that global developers have access to with a pem file.
I am aware of vagrant cloud but that is not an option in this case.
It looks like the packaged curl command does indeed support scp
but for some reason it is not respecting the values I have in my ~/.ssh/config
and it's not providing the identity file and username when vagrant up is ran.
I can confirm that the following command does work.
/opt/vagrant/embedded/bin/curl --verbose \
"scp://myurl.com:/path/to/base.box" --insecure \
--key ~/.ssh/my-key.pem --user admin: --output test.box
How can i pass the required options to the base_url
or make the packaged version of curl respect my ssh config file?
Here is the config block im using in my vagrantfile
config.vm.define :devbox, primary: true do |devbox|
devbox.vm.box_download_insecure = true
devbox.vm.box = "base-box"
devbox.vm.box_url = "scp://mydomain.com:/path/to/base.box"
end
Any guidance would be greatly appreciated, I have wasted about 10 hours on this so far.
After submitting an issue on the vagrant github project: https://github.com/hashicorp/vagrant/issues/11546
They have responded and released an update in version 2.2.9
that will allow you to specify additional box download options.
The necesary keys that are needed are in the below example, but you can pass any curl argument as the key and its value as the value.
config.vm.box_url = "scp://example.com:/path/to/your/box.box"
config.vm.box_download_options = {
key: "~/.ssh/secretkey.pem",
user: "username:" # Important, keep the : for no password
}
it is important to add the :
after the username as that denotes there is no password since we are using private key authentication.
Hope this helps someone else.