Created
August 13, 2014 16:29
-
-
Save jgornick/02a5aa01bd0bb852d836 to your computer and use it in GitHub Desktop.
Vagrant + Ruby: Require Environment Variables in Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
variables = %w{ANSIBLE_PATH ANSIBLE_VAULT_PASS} | |
missing = variables.find_all { |v| ENV[v] == nil } | |
unless missing.empty? | |
puts "FATAL: The following variables are missing and are needed to run this script: #{missing.join(', ')}." | |
exit | |
end | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment