Skip to content

Instantly share code, notes, and snippets.

@dbarbar
Created August 27, 2013 18:07
Show Gist options
  • Save dbarbar/6356952 to your computer and use it in GitHub Desktop.
Save dbarbar/6356952 to your computer and use it in GitHub Desktop.
Initial attempt at a Vagrantfile and puppet manifest for Springboard 4.
class apt-get {
exec { "apt-get update":
command => "/usr/bin/apt-get update",
}
# this times out
#exec { "apt-get upgrade":
# command => "/usr/bin/apt-get upgrade -y",
# require => Exec['apt-get update']
#}
}
class php {
# @todo Install xdebug
package {'php5':
ensure => present,
#before => File['/etc/php.ini'],
require => Exec['apt-get update'],
notify => Service['apache2']
}
package { "php5-cli":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php5-common":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php5-dev":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php-pear":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php5-mysqlnd":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php5-gd":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
package { "php5-mcrypt":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
# Seriously? php5-curl doesn't require curl?
package { "curl":
ensure => present,
before => Package['php5-curl'],
notify => Service['apache2']
}
package { "php5-curl":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
#package { "php5-imap":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
#package { "php5-soap":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
#package { "php5-intl":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
package { "php-apc":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
#package { "php5-pecl-imagick":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
#package { "php5-pecl-xdebug":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
#package { "php5-xml":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
#package { "php5-bcmath":
# ensure => present,
# require => Package['php5'],
# notify => Service['apache2']
#}
package { "php5-xmlrpc":
ensure => present,
require => Package['php5'],
notify => Service['apache2']
}
}
class pear {
exec {'pear upgrade PEAR':
command => '/usr/bin/pear upgrade PEAR',
require => Package['php-pear']
}
exec {'pear channel update':
command => '/usr/bin/pear channel-update pear.php.net',
require => Package['php-pear']
}
}
class drush {
# @todo Call drush make to install sb4 inside /vagrant/src
# @todo Fix this to run only once and not every time
exec {'drush discover':
command => '/usr/bin/pear channel-discover pear.drush.org',
require => Package['php-pear']
}
exec {'install drush':
command => '/usr/bin/pear install drush/drush',
require => Exec['drush discover']
}
exec {'install drush dependencies':
command => '/usr/bin/drush',
require => Exec['install drush']
}
}
class apache2 {
# @todo enable mod_rewrite exec a2enmod rewrite
package {'apache2':
ensure => present,
require => Exec['apt-get update'],
}
file {'/var/www':
ensure => link,
target => "/vagrant/src",
force => true,
require => Package['apache2']
}
# @todo Figure out the ubuntu equivalent of httpd-devel
# package { "apache2-devel":
# ensure => present
# }
service {'apache2':
ensure => running,
enable => true,
require => Package['apache2'],
#subscribe => File['/etc/php.ini'],
}
}
class mysql {
# @todo Create the sb4 database CREATE DATABASE sb4;
package {'mysql-server':
ensure => 'present',
require => Exec['apt-get update'],
}
package {'mysql-client':
ensure => 'present',
require => Exec['apt-get update'],
}
service {'mysql':
ensure => running,
enable => true,
require => Package['mysql-server'],
}
}
include apt-get
include php
include pear
include drush
include apache2
include mysql
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("1") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu1204-64"
#Configure the RAM to 1024
#config.vm.customize ["modifyvm", :id,"--name", "Test_Environment","--memory", "1024"]
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://dl.dropbox.com/u/1537815/precise64.box"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :hostonly, "192.168.33.11"
config.vm.host_name = "local.dev"
# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.
# config.vm.network :bridged
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
# config.vm.forward_port 80, 8080
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
config.vm.share_folder("vagrant-root", "/vagrant", ".", {:extra => 'dmode=777,fmode=777'})
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file puppetlabs-centos63.pp in the manifests_path directory.
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "main.pp"
end
end
Vagrant.configure("2") do |config|
#Allocate 1GB to ram
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment