You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2012/07/27 03:36:11 UTC

[4/37] git commit: Initial commit converting the devcloud build process to being based on puppet and vagrant.

Initial commit converting the devcloud build
process to being based on puppet and vagrant.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/827943a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/827943a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/827943a8

Branch: refs/heads/master
Commit: 827943a865d80113fe01ab06e3c3b2f41579b2c3
Parents: 03eab4d
Author: chip.childers@gmail.com <ch...@gmail.com>
Authored: Thu Jul 19 04:12:19 2012 -0400
Committer: chip.childers@gmail.com <ch...@gmail.com>
Committed: Thu Jul 19 04:12:19 2012 -0400

----------------------------------------------------------------------
 tools/devcloud/README                              |    6 +
 tools/devcloud/puppet/README                       |   12 ++
 tools/devcloud/puppet/fileserver.conf              |    4 +
 .../puppet/puppet-devcloudinitial/Modulefile       |    8 ++
 .../puppet/puppet-devcloudinitial/files/grub       |   34 ++++++
 .../puppet/puppet-devcloudinitial/files/interfaces |   16 +++
 .../puppet-devcloudinitial/files/network.conf      |    1 +
 .../puppet-devcloudinitial/files/xen-defaults      |    1 +
 .../puppet-devcloudinitial/manifests/init.pp       |   87 +++++++++++++++
 tools/devcloud/ubuntu_install/README               |    1 +
 tools/devcloud/vagrant/Vagrantfile                 |   66 +++++++++++
 tools/devcloud/vagrant/vagrant.pp                  |   43 +++++++
 12 files changed, 279 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/README
----------------------------------------------------------------------
diff --git a/tools/devcloud/README b/tools/devcloud/README
new file mode 100644
index 0000000..49fc086
--- /dev/null
+++ b/tools/devcloud/README
@@ -0,0 +1,6 @@
+This folder contains various scripts used to build the devcloud image.
+
+Folders:
+puppet - puppet conf files and module directories for the various build phases
+vagrant - basic vagrant configuration for a devcloud box (and a puppet manifest to help configure the system to be a valid vagrant box)
+ubuntu_install - ubuntu installation / initial configuration

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/README
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/README b/tools/devcloud/puppet/README
new file mode 100644
index 0000000..f15f440
--- /dev/null
+++ b/tools/devcloud/puppet/README
@@ -0,0 +1,12 @@
+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

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/fileserver.conf
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/fileserver.conf b/tools/devcloud/puppet/fileserver.conf
new file mode 100644
index 0000000..9bc290c
--- /dev/null
+++ b/tools/devcloud/puppet/fileserver.conf
@@ -0,0 +1,4 @@
+[files]
+  path /vagrant
+  allow *
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile b/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile
new file mode 100644
index 0000000..b15a29e
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile
@@ -0,0 +1,8 @@
+name    'puppet-devcloudinitial'
+version '0.0.1'
+source ''
+author 'Apache Software Foundation'
+license 'Apache 2.0'
+summary 'CloudStack DevCloud initial configuration module'
+description 'Installation and configuration of all prequisites for building a DevCloud image.'
+project_page 'http://cloudstack.org'

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/files/grub
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/grub b/tools/devcloud/puppet/puppet-devcloudinitial/files/grub
new file mode 100644
index 0000000..8813800
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/files/grub
@@ -0,0 +1,34 @@
+# If you change this file, run 'update-grub' afterwards to update
+# /boot/grub/grub.cfg.
+# For full documentation of the options in this file, see:
+#   info -f grub -n 'Simple configuration'
+
+GRUB_DEFAULT=0
+#GRUB_HIDDEN_TIMEOUT=0
+GRUB_HIDDEN_TIMEOUT_QUIET=true
+GRUB_TIMEOUT=2
+GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
+GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX=""
+
+# Uncomment to enable BadRAM filtering, modify to suit your needs
+# This works with Linux (no patch required) and with any kernel that obtains
+# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
+#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
+
+# Uncomment to disable graphical terminal (grub-pc only)
+#GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+#GRUB_GFXMODE=640x480
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+#GRUB_DISABLE_RECOVERY="true"
+
+# Uncomment to get a beep at grub start
+#GRUB_INIT_TUNE="480 440 1"

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces b/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces
new file mode 100644
index 0000000..cf88183
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces
@@ -0,0 +1,16 @@
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+auto xenbr0
+iface xenbr0 inet dhcp
+    gateway 10.0.2.2
+    bridge_ports eth0
+
+
+auto eth0
+iface eth0 inet dhcp
+pre-up iptables-save < /etc/iptables.save
+pre-up /etc/init.d/ebtables load
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf b/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf
new file mode 100644
index 0000000..7096907
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf
@@ -0,0 +1 @@
+bridge

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults b/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults
new file mode 100644
index 0000000..6886290
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults
@@ -0,0 +1 @@
+TOOLSTACK=xapi

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp b/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp
new file mode 100644
index 0000000..27bf478
--- /dev/null
+++ b/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp
@@ -0,0 +1,87 @@
+class puppet-devcloudinitial {
+
+  package { 'linux-headers-3.2.0-23-generic':
+    ensure => latest,
+  }
+
+  package { 'xen-hypervisor-4.1-amd64':
+    ensure => latest,
+  }
+
+  package { 'xcp-xapi':
+    ensure => latest,
+  }
+
+  file { '/etc/xcp/network.conf':
+    ensure  => 'file',
+    source  => 'puppet:///files/puppet-devcloudinitial/files/network.conf',
+    group   => '0',
+    mode    => '644',
+    owner   => '0',
+  }
+
+  exec { "/bin/sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend":
+    cwd     => '/etc/init.d',
+  }
+
+  service { 'xendomains':
+    ensure => 'stopped',
+    enable => 'false',
+  }
+
+  file { '/etc/default/grub':
+    ensure  => 'file',
+    source  => 'puppet:///files/puppet-devcloudinitial/files/grub',
+    group   => '0',
+    mode    => '644',
+    owner   => '0',
+  }
+
+  exec { "/usr/sbin/update-grub":
+    cwd     => '/',
+  }
+
+  file { '/usr/share/qemu':
+    ensure => 'directory',
+    group  => '0',
+    mode   => '755',
+    owner  => '0',
+  }
+
+  file { '/usr/share/qemu/keymaps':
+    ensure => 'link',
+    group  => '0',
+    mode   => '777',
+    owner  => '0',
+    target => '/usr/share/qemu-linaro/keymaps',
+  }
+
+  file { '/etc/network/interfaces':
+    ensure  => 'file',
+    source  => 'puppet:///files/puppet-devcloudinitial/files/interfaces',
+    group   => '0',
+    mode    => '644',
+    owner   => '0',
+  }
+
+  file { '/etc/default/xen':
+    ensure  => 'file',
+    source  => 'puppet:///files/puppet-devcloudinitial/files/xen-defaults',
+    group   => '0',
+    mode    => '644',
+    owner   => '0',
+  }
+
+  user { 'root':
+    ensure           => 'present',
+    comment          => 'root',
+    gid              => '0',
+    home             => '/root',
+    password         => '$6$SCixzUjT$sVs9PwR2g7XdHSLnQW5Zsy2dVpVV3qESFV4Joniusbu3BqWUtKgc91vwEDwPhLqyCYM3kKR1.7G9g2Hu/pTQN/',
+    password_max_age => '99999',
+    password_min_age => '0',
+    shell            => '/bin/bash',
+    uid              => '0',
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/ubuntu_install/README
----------------------------------------------------------------------
diff --git a/tools/devcloud/ubuntu_install/README b/tools/devcloud/ubuntu_install/README
new file mode 100644
index 0000000..7432dbc
--- /dev/null
+++ b/tools/devcloud/ubuntu_install/README
@@ -0,0 +1 @@
+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.

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/vagrant/Vagrantfile
----------------------------------------------------------------------
diff --git a/tools/devcloud/vagrant/Vagrantfile b/tools/devcloud/vagrant/Vagrantfile
new file mode 100644
index 0000000..009d978
--- /dev/null
+++ b/tools/devcloud/vagrant/Vagrantfile
@@ -0,0 +1,66 @@
+# -*- 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 = "devcloudbase-ubuntu-12-04-64bit"
+  # TODO: Get a URL to host the base image
+  # config.vm.box_url = "http://domain.com/path/to/above.box"
+
+  # 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 :shell, :inline => "/vagrant/devcloudsetup.sh -p -v"
+
+  # 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

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/827943a8/tools/devcloud/vagrant/vagrant.pp
----------------------------------------------------------------------
diff --git a/tools/devcloud/vagrant/vagrant.pp b/tools/devcloud/vagrant/vagrant.pp
new file mode 100644
index 0000000..1be6626
--- /dev/null
+++ b/tools/devcloud/vagrant/vagrant.pp
@@ -0,0 +1,43 @@
+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',
+}