Checkpoint commit - work in progress.

Attempting to provide devcloud base box build process via veewee and
puppet provisining via Vagrant.
This commit is contained in:
chip.childers@gmail.com 2012-07-27 23:35:01 -04:00
parent 2943dc22d7
commit 25e0cc9d75
18 changed files with 161 additions and 87 deletions

View File

@ -19,13 +19,15 @@
# under the License.
Vagrant::Config.run do |config|
config.vm.box = "devcloudbase-ubuntu-12-04-64bit"
config.vm.box = "devcloud"
# TODO: Get a URL to host the base image
# config.vm.box_url = "http://domain.com/path/to/above.box"
config.vm.guest = :xen
config.ssh.username = "devcloud"
# Uncomment this line to enable the console for debugging the
# build process.
#config.vm.boot_mode = :gui
config.vm.boot_mode = :gui
# Setup port forwarding
config.vm.forward_port 22, 2222
@ -46,27 +48,4 @@ Vagrant::Config.run do |config|
puppet.module_path = "puppet-devcloudinitial"
end
# 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 my_box.pp in the manifests_path directory.
#
# An example Puppet manifest to provision the message of the day:
#
# # group { "puppet":
# # ensure => "present",
# # }
# #
# # File { owner => 0, group => 0, mode => 0644 }
# #
# # file { '/etc/motd':
# # content => "Welcome to your Vagrant-built virtual machine!
# # Managed by Puppet.\n"
# # }
#
# config.vm.provision :puppet do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "my_box.pp"
# end
end

View File

@ -3,7 +3,7 @@
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_DEFAULT=2
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=2

View File

@ -4,12 +4,12 @@ class puppet-devcloudinitial {
ensure => latest,
}
package { 'xen-hypervisor-4.1-amd64':
package { 'xen-hypervisor-4.1-i386':
ensure => latest,
}
package { 'xcp-xapi':
require => Package['xen-hypervisor-4.1-amd64'],
require => Package['xen-hypervisor-4.1-i386'],
ensure => latest,
}
@ -38,7 +38,7 @@ class puppet-devcloudinitial {
}
file { '/etc/default/grub':
require => Package['xen-hypervisor-4.1-amd64'],
require => Package['xen-hypervisor-4.1-i386'],
ensure => 'file',
source => 'puppet:///modules/puppet-devcloudinitial/grub',
group => '0',
@ -53,7 +53,7 @@ class puppet-devcloudinitial {
}
file { '/usr/share/qemu':
require => Package['xen-hypervisor-4.1-amd64'],
require => Package['xen-hypervisor-4.1-i386'],
ensure => 'directory',
group => '0',
mode => '755',
@ -78,7 +78,7 @@ class puppet-devcloudinitial {
}
file { '/etc/default/xen':
require => Package['xen-hypervisor-4.1-amd64'],
require => Package['xen-hypervisor-4.1-i386'],
ensure => 'file',
source => 'puppet:///modules/puppet-devcloudinitial/xen-defaults',
group => '0',

51
tools/devcloud/devcloudbox/Vagrantfile vendored Normal file
View File

@ -0,0 +1,51 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
Vagrant::Config.run do |config|
config.vm.box = "devcloud"
# TODO: Get a URL to host the base image
# config.vm.box_url = "http://domain.com/path/to/above.box"
config.vm.guest = :xen
config.ssh.username = "devcloud"
# Uncomment this line to enable the console for debugging the
# build process.
config.vm.boot_mode = :gui
# Setup port forwarding
config.vm.forward_port 22, 2222
config.vm.forward_port 8080, 8080
config.vm.forward_port 8443, 8443
config.vm.forward_port 5901, 5901
config.vm.forward_port 8787, 8787
config.vm.forward_port 8250, 8250
# Ensure the VM has the right virtual resources
#config.vm.
# config.vm.provision :puppet do |puppet|
# puppet.manifests_path = "puppet-devcloud"
# puppet.manifest_file = "init.pp"
# puppet.with_ssh = true
# puppet.pp_path = "/etc/puppet"
# puppet.module_path = "puppet-devcloud"
# end
end

View File

@ -0,0 +1,8 @@
name 'puppet-devcloud'
version '0.0.1'
source ''
author 'Apache Software Foundation'
license 'Apache 2.0'
summary 'CloudStack DevCloud configuration module'
description 'Devcloud setup module.'
project_page 'http://cloudstack.org'

View File

@ -0,0 +1,17 @@
# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012
*mangle
:PREROUTING ACCEPT [397:23804]
:INPUT ACCEPT [397:23804]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [238:22820]
:POSTROUTING ACCEPT [238:22820]
-A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
COMMIT
# Completed on Sat Jul 28 03:18:44 2012
# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012
*filter
:INPUT ACCEPT [453:27164]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [273:26476]
COMMIT
# Completed on Sat Jul 28 03:18:44 2012

View File

@ -0,0 +1 @@
include puppet-devcloud

View File

@ -0,0 +1,32 @@
class puppet-devcloud {
package { 'ebtables':
ensure => latest,
}
service { 'ebtables':
require => Package['ebtables'],
ensure => 'running',
enable => 'true',
}
package { 'iptables':
ensure => latest,
}
file { '/etc/iptables.save':
require => Package['iptables'],
ensure => 'file',
source => 'puppet:///modules/puppet-devcloud/iptables.save',
group => '0',
mode => '644',
owner => '0',
}
exec { "mac=`ifconfig xenbr0 |grep HWaddr |awk '{print $5}'`; /sbin/ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP":
subscribe => Package['ebtables'],
refreshonly => true,
cwd => '/',
}
}

View File

@ -1,12 +0,0 @@
To use:
Preconfiguration phase -
- [setup your box in vagrant and place the contents of tools/devcloud/puppet into the box's folder]
- vagrant up; vagrant ssh
- sudo bash
- ln -s /vagrant/puppet-devcloudinitial /etc/puppet/modules/puppet-devcloudinitial
- cd /vagrant
- puppet apply --fsconfig fileserver.conf --debug --verbose -e "include puppet-devcloudinitial"
Postconfiguration phase -
TODO

View File

@ -1 +0,0 @@
Nothing in this directory yet, but it will contain the scripts and preconfiguration files to build the basic Ubuntu 12.04 server used in devcloud.

View File

@ -1,43 +0,0 @@
group { 'vagranttest':
ensure => 'present',
gid => '5000',
}
group { 'admin':
ensure => 'present',
gid => '1002',
}
user { 'vagranttest':
ensure => 'present',
comment => 'vagrant,,,',
gid => '5000',
groups => ['adm', 'cdrom', 'dip', 'plugdev', 'lpadmin', 'sambashare', 'admin'],
home => '/home/vagranttest',
shell => '/bin/bash',
uid => '5000',
}
file { '/home/vagranttest':
ensure => 'directory',
group => '1002',
mode => '755',
owner => '5000',
}
file { '/home/vagranttest/.ssh':
ensure => 'directory',
group => '1002',
mode => '775',
owner => '5000',
}
$auth_key = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
file { '/home/vagranttest/.ssh/authorized_keys':
ensure => 'file',
content => $auth_key,
group => '1002',
mode => '664',
owner => '5000',
}

View File

@ -0,0 +1,42 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
apt-get -y update
apt-get -y upgrade
apt-get -y install vim
apt-get -y install ruby
apt-get -y install rubygems
apt-get -y install puppet
apt-get clean
# Setup sudo to allow no-password sudo for "admin"
groupadd -r admin
usermod -a -G admin devcloud
sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers
mkdir /home/devcloud/.ssh
chmod 700 /home/devcloud/.ssh
cd /home/devcloud/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
chmod 600 /home/devcloud/.ssh/authorized_keys
chown -R devcloud /home/devcloud/.ssh
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY