Created
July 20, 2012 22:41
-
-
Save opennetadmin/3153707 to your computer and use it in GitHub Desktop.
Simple Vagrant config file. It will get you a precise64 box and start up a puppet run using bridged networking
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/default.pp | |
# this file will get you an OpenNetAdmin install via puppet to use for testing | |
# currently it installs the ipv6 branch using a tarball download. it does not | |
# set it up as a git checkout etc | |
class system { | |
exec { 'apt-get update': | |
command => '/usr/bin/apt-get update' | |
} | |
} | |
# installs basic LAMP stuff and a few other things | |
class basepackages { | |
$packagelist = ['apache2','php5','mysql-server','php5-mysql','git','curl','libapache2-mod-php5','php5-gmp'] | |
package { $packagelist: | |
ensure => present, | |
} | |
} | |
# Download and isntall ONA from github master | |
class ona { | |
$ONABASE='/opt/ona' | |
file { $ONABASE: | |
ensure => directory, | |
} | |
file { "${ONABASE}/www/local/config": | |
ensure => directory, | |
owner => 'www-data', | |
group => 'www-data', | |
require => File[$ONABASE], | |
} | |
file { '/var/log/ona.log': | |
ensure => present, | |
owner => 'www-data', | |
group => 'www-data', | |
} | |
file { '/etc/onabase': | |
ensure => present, | |
content => $ONABASE, | |
} | |
file { '/etc/apache2/sites-available/default': | |
ensure => present, | |
notify => Service['apache2'], | |
content => ' | |
NameVirtualHost *:80 | |
NameVirtualHost *:443 | |
<VirtualHost *:80> | |
UseCanonicalName Off | |
ServerAdmin webmaster@localhost | |
DocumentRoot /opt/ona/www/ | |
</VirtualHost> | |
#<VirtualHost *:443> | |
# SSLEngine on | |
# SSLCertificateFile /etc/ssl/certs/cert.pem | |
# ServerAdmin webmaster@localhost | |
# DocumentRoot /opt/ona/www/ | |
#</VirtualHost> | |
<Directory /opt/ona/www/> | |
Options +FollowSymLinks | |
AllowOverride All | |
order allow,deny | |
allow from all | |
</Directory> | |
', | |
} | |
# to get an update, you must remove /opt/onamaster.tgz first | |
exec { 'onadownload': | |
command => '/usr/bin/curl -kL -o /opt/onamaster.tgz https://github.com/opennetadmin/ona/tarball/ona-ipv6', | |
#command => '/usr/bin/curl -kL -o /opt/onamaster.tgz https://github.com/opennetadmin/ona/tarball/master', | |
creates => '/opt/onamaster.tgz', | |
} | |
exec { 'onainstall': | |
command => "/bin/tar --strip-components=1 -C ${ONABASE} -zxvf /opt/onamaster.tgz", | |
creates => '/opt/ona/www', | |
require => [File[$ONABASE],Exec['onadownload'],], | |
} | |
service { 'apache2': | |
ensure => running, | |
require => Package['apache2'], | |
} | |
} | |
include system | |
include basepackages | |
include ona | |
Class['system'] -> Class['basepackages'] -> Class['ona'] -> Notify['ipinfo'] | |
notify{ 'ipinfo': message => "------------ This servers IP is: ${ipaddress_eth1} -----------------", } |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "precise64" | |
# Set a hostname | |
config.vm.host_name = "ona-vm" | |
# 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://domain.com/path/to/above.box" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
# 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.10" | |
# 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" | |
# 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 precise64.pp in the manifests_path directory. | |
# | |
# config.vm.provision :puppet do |puppet| | |
# puppet.manifests_path = "manifests" | |
# puppet.manifest_file = "precise64.pp" | |
# end | |
config.vm.provision :puppet | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment