Best way to copy files onto my VM at provision time?

8 views
Skip to first unread message

tra...@immersionactive.com

unread,
Aug 16, 2018, 12:09:44 PM8/16/18
to Vagrant
Hi there –

I'm creating a Vagrantfile for a VM running Ubuntu. This Vagrantfile runs a bootstrap.sh script, which installs various packages via apt-get. I keep both of these files in a Git repository, for easy sharing with other developers.

Here's my challenge: in addition to installing the apt packages, I'd like my bootstrap.sh to copy a few files onto the VM. (For example, I have a custom makevhost.sh script which needs to be available on the VM.)

What's the best way to do this, without putting the contents of makevhost.sh inline in bootstrap.sh (in a cat command or similar)?

My Vagrantfile also defines a synced folder, so I could put makevhost.sh in that directory, so that it'll be accessible to guest machine (and therefore accessible to bootstrap.sh) – but I'd prefer to avoid that.

Is there an established practice for accomplishing this? I'm sure it's a common goal.

Thanks!

tra...@immersionactive.com

unread,
Aug 16, 2018, 12:19:23 PM8/16/18
to Vagrant
Aaand that's what I get for posting before Googling.

This is easily done in the Vagrantfile itself, by using file provisioning:


Sorry for the noise.
Reply all
Reply to author
Forward
0 new messages