Running basic shell commands
The most basic method of provisioning is to run simple shell commands in the Vagrant machine. For Linux environments, this typically means executing basic shell commands with shells that are typically bundled with distributions (sh
, bash
, zsh
, and so on). The provisioning process can also execute other command-line applications if runtime environments are installed (such as system provisioning with Ruby or Perl).
In this example, we'll use a shell command to install a basic Message of The Day
command to output a greeting on login using the vagrant ssh
command.
How to do it...
- We'll start this example with a simple Vagrantfile that boots a basic Ubuntu environment. Here is the complete Vagrantfile:
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "puppetlabs/ubuntu-14.04-32-nocm" end
Booting this environment with
vagrant up
will start a basic...