Automating Help

I'm working a demo for Vagrant for a class I'm taking and I'm attempting to show an easy setup for a cloud environment on a local machine for development.

I've spent some time reading the documentation and my Vagrantfile will set up a load balancer and 3 web servers.

I should be able to setup private ips for all of them using

lb.vm.network "private_network", ip: "10.4.4.58"
web1.vm.network "private_network", ip: "10.4.4.59"
etc...

One problem I've hit is I would like to have for example my nginx.conf automatically replace the one in the new virtual machine. The problem is if I have files in the shared folder when it brings up a machine while it will use the ones I put, the old one's will be renamed to file-old and Vagrant will throw an error and stop bringing up machines.

My shell script for the load balancer is just:

apt-get update
apt-get install -y nginx

Is there another option I can add that will tell it to overwrite the files?

Also if you have tips for getting databases up and running and easy ways to connect everything through Vagrant I'd appreciate it.

2 thoughts on “Automating Help”

  1. Have you tried to put the mount dir after the nginx install in your config? you can set mount points so just have an /vagrant/mnt/etc/nginx on your local host and mount over the /etc/nginx in the VM.

    But yes you are approaching the point you need a provisioning tool.

    Reply

Leave a Comment