--
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/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/3fbb36a9-73a1-49a3-998e-bcb73aac6fc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Shared folder goes from host to guestwhat you can do is copy the folder out and then mount it on the guesthowever will be a bit late (after servides start) and you will be need to reload the services after.So you can just copy the files to the location and restart/reload the service in one single script. to keep things simple.
$script = <<SCRIPT
cp -ap /vagrant/nginx/* /etc/nginx/chkconfig nginx onservice nginx reloadSCRIPT
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $script
end
--
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/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAGNcf%2BHLyHnvFb%3DNjYPLOp0QvMY%3Dbvv3d0_BZsd8f7vk8mjuBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/XVFPIOXU8aI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exp6Rdwp7WKaU6%3DBeLk9aaXNsJYJB_9kFYZh%2By5x5x0CQ%40mail.gmail.com.
Please share back what you got working, so other people can learn from it.Sharing is caring :D
# cp -ap /vagrant/nginx/* /etc/nginx/ ## should be:cp -ap /vagrant/nginx/. /etc/nginx/# chkconfig nginx on## chkconfig is not shipped with Ubuntu since 12.04,## if my research is accurate. Should be:service nginx start
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
# Install nginx.
apt-get -y update
apt-get -y install nginx
service nginx start
# Copy the nginx and www folders to the /vagrant folder, so that they
# can be synced with the host. The www and nginx folders will be
# created automatically. They don't need to exist on the host yet.
cp -ap /etc/nginx/. /vagrant/nginx/
cp -ap /var/www/. /vagrant/www/
# Syncing must be done as a second step. Uncomment the lines beginning
# #*# below after the first `vagrant up`, then use `vagrant reload`
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
#Run a provisioning script on first launch
config.vm.provision "shell", inline: $script
## Sync the www and nginx folders, so that they can be edited on
## the host machine.
## Uncomment the next line only after the box has been provisioned,
## otherwise the host's nginx/folder will overwrite the
## guest's installation.
#*#config.vm.synced_folder 'www', '/var/www'
#*#config.vm.synced_folder 'nginx', '/etc/nginx'
## On the first `vagrant up`, Vagrant will automatically create a
## /vagrant file at the root of the guest, and sync it with the
## folder that contains this Vagrantfile. This is necessary so that
## the command `cp -ap /etc/nginx/. /vagrant/nginx/` can copy the
## contents of the /etc/nginx/ folder to the host.
##
## On subsequent launches, only the ./www/ and ./nginx/ folders need
## to be synced, so you can uncomment the line below.
#*#config.vm.synced_folder '.', '/vagrant', disabled: true
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
# Install nginx.
apt-get -y update
apt-get -y install nginx
service nginx start
# Copy the nginx and www folders to the /vagrant folder, so that they
# can be synced with the host. The www and nginx folders will be
# created automatically. They don't need to exist on the host yet.
cp -ap /etc/nginx/. /vagrant/nginx/
cp -ap /var/www/. /vagrant/www/
# Syncing must be done as a second step. Uncomment the lines beginning
# #*# below after the first `vagrant up`, then use `vagrant reload`
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
#Run a provisioning script on first launch
config.vm.provision "shell", inline: $script
## Sync the www and nginx folders, so that they can be edited on
## the host machine.
## Uncomment the next line only after the box has been provisioned,
## otherwise the host's nginx/folder will overwrite the
## guest's installation.
config.vm.synced_folder 'www', '/var/www'
config.vm.synced_folder 'nginx', '/etc/nginx'
## On the first `vagrant up`, Vagrant will automatically create a
## /vagrant file at the root of the guest, and sync it with the
## folder that contains this Vagrantfile. This is necessary so that
## the command `cp -ap /etc/nginx/. /vagrant/nginx/` can copy the
## contents of the /etc/nginx/ folder to the host.
##
## On subsequent launches, only the ./www/ and ./nginx/ folders need
## to be synced, so you can uncomment the line below.
config.vm.synced_folder '.', '/vagrant', disabled: true
end
--
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/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/565994ce-4612-4cfc-ae01-48a12983e5b2%40googlegroups.com.