Last active
December 12, 2015 01:08
-
-
Save garthk/4688847 to your computer and use it in GitHub Desktop.
Vagrant trick: upgrade Puppet, update apt-get, and install Puppet modules before the Puppet provisioner runs.
This file contains hidden or 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
# Manifest to install Puppet modules for Vagrant. | |
$vpup = '/opt/vagrant_ruby/bin/puppet' | |
$vmods = '/tmp/vagrant-puppet/modules' | |
define vpupmod() { | |
$modulename = inline_template('<%= name.split("/")[1] %>') | |
exec { "install module ${name}": | |
command => "${vpup} module install ${name} --modulepath ${vmods}", | |
creates => "${vmods}/${modulename}", | |
} | |
} | |
vpupmod { ['cprice404/inifile', 'puppetlabs/stdlib']: } |
This file contains hidden or 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
MANIFESTS = [ | |
'vagrant-prereq.pp', # prerequisites, e.g. other Puppet modules | |
'vagrant.pp' # the Logstash configuration we're testing | |
] | |
# Run the Puppet provisioner for each manifest | |
for manifest in MANIFESTS | |
ls.vm.provision :puppet do |puppet| | |
puppet.manifests_path = "tests" | |
puppet.manifest_file = manifest | |
puppet.options = ["--modulepath", "/tmp/vagrant-puppet/modules"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment