Skip to content

Commit

Permalink
Update Vagrantfile - Put the puppet install script in a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
abessifi committed Mar 22, 2015
1 parent 5969cd5 commit 1f2dd89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
13 changes: 1 addition & 12 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ pg_slaves = []
pg_slaves << {:hostname => "pg-slave-#{id}", :ip => "192.168.10.#{ip_last_byte}"}
}

$install_puppet = <<SCRIPT
[ "$(puppet --version)" = "3.7.4" ] && echo "Puppet '3.7.4' is already installed \!" && exit 0
wget --output-document=/tmp/puppetlabs-release-wheezy.deb https://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
[ -f /tmp/puppetlabs-release-wheezy.deb ] || exit 1
sudo dpkg -i /tmp/puppetlabs-release-wheezy.deb
sudo apt-get update
sudo apt-get install -y puppet=3.7.4-1puppetlabs1
echo "Puppet $(puppet --version) is now installed."
rm /tmp/puppetlabs-release-wheezy.deb
SCRIPT

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Expand All @@ -39,7 +28,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true
# Install Puppet package in all nodes
config.vm.provision "shell", inline: $install_puppet
config.vm.provision "shell", path: "./scripts/install_puppet.sh"
# PostgreSQL master VM
config.vm.define "pg-master" do |cfg|
cfg.vm.hostname = "pg-master.#{DOMAIN}"
Expand Down
17 changes: 17 additions & 0 deletions scripts/install_puppet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Check if Puppet package is already installed
[ "$(puppet --version)" = "3.7.4" ] && echo "Puppet '3.7.4' is already installed !" \
&& exit 0
# Download puppetlabs-release-wheezy.deb
wget --output-document=/tmp/puppetlabs-release-wheezy.deb https://apt.puppetlabs.com/puppetlabs-release-wheezy.deb

[ -f /tmp/puppetlabs-release-wheezy.deb ] || exit 1
# Install the puppetlabs-release-wheezy.deb which will setup the puppet repos entries in /etc/apt/sources.list.d/puppetlabs.list file.
sudo dpkg -i /tmp/puppetlabs-release-wheezy.deb
sudo apt-get update
# Install puppet 3.7.4 package
sudo apt-get install -y puppet=3.7.4-1puppetlabs1
echo "Puppet $(puppet --version) is now installed."
# Remove the temporary download package
rm /tmp/puppetlabs-release-wheezy.deb

0 comments on commit 1f2dd89

Please sign in to comment.