Executing shell scripts in a Vagrantfile
Provisioning a Vagrant machine with single inline string arguments can make simple provisioning tasks easy, but more complicated requirements can require more complicated scripts. Scripts can be defined within Vagrantfiles using the multiline string feature of Ruby. A multiline string will allow a definition of a set of commands that can be executed with the Vagrant
This example will also demonstrate how we can make a script idempotent, which is capable of being executed multiple times without changing the end state of the machine after every run.
In this example, we will provision a new Vagrant environment, install the nginx web server, and replace the default web directory with ...