Skip to content

Instantly share code, notes, and snippets.

@mattpascoe
Forked from opennetadmin/Vagrantfile
Last active March 3, 2016 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpascoe/3828026 to your computer and use it in GitHub Desktop.
Save mattpascoe/3828026 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
# manifests/default.pp
# this file will get you an OpenNetAdmin install via puppet to use for testing
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',
'build-essential',
'php-pear',
'libyaml-dev']
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>
',
}
# TODO: install 'pecl install yaml'
exec { 'onaclone':
command => '/usr/bin/git clone https://github.com/opennetadmin/ona.git /opt/ona',
creates => '/opt/ona',
require => Package['git'],
}
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} -----------------", }
# -*- 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