Skip to content

Commit

Permalink
Merge pull request #438 from mpapis/master
Browse files Browse the repository at this point in the history
OpenBSD fixes + new templates for 5.2
  • Loading branch information
jedi4ever committed Dec 4, 2012
2 parents 426c481 + 7655c0e commit 71176b0
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 5 deletions.
2 changes: 1 addition & 1 deletion templates/openbsd50_amd64/definition.rb
Expand Up @@ -2,7 +2,7 @@
:cpu_count => '1', :memory_size=> '256',
:disk_size => '40960', :disk_format => 'VDI', :hostiocache => 'off',
:os_type_id => 'OpenBSD_64',
:iso_file => "install50.iso",
:iso_file => "openbsd50_64.iso",
:iso_src => "http://ftp3.usa.openbsd.org/pub/OpenBSD/5.0/amd64/install50.iso",
:iso_md5 => "2b7d7ca2acc7f148bd92f065034f9f5a",
:iso_download_timeout => "1000",
Expand Down
8 changes: 4 additions & 4 deletions templates/openbsd50_i386/definition.rb
@@ -1,8 +1,8 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '256',
:disk_size => '40960', :disk_format => 'VDI', :hostiocache => 'off',
:os_type_id => 'OpenBSD_64',
:iso_file => "install50.iso",
:os_type_id => 'OpenBSD_32',
:iso_file => "openbsd50_32.iso",
:iso_src => "http://ftp.plig.net/pub/OpenBSD/5.0/i386/install50.iso",
:iso_md5 => "2f0cc4df7dfe095f15a8ddadf8a02f69",
:iso_download_timeout => "1000",
Expand All @@ -12,7 +12,7 @@
# set the keyboard
'us<Enter>',
# set the hostname
'OpenBSD50-x64<Enter>',
'OpenBSD50-x32<Enter>',
# Which nic to config ? [em0]
'<Enter>',
# do you want dhcp ? [dhcp]
Expand Down Expand Up @@ -57,7 +57,7 @@
'cd<Enter>',
# Available cd-roms : cd0
'<Enter>',
# Pathneame to sets ? [5.0/amd64]
# Pathneame to sets ? [5.0/i386]
'<Enter>',
# Remove games and X
'-game50.tgz<Enter>',
Expand Down
28 changes: 28 additions & 0 deletions templates/openbsd52_amd64/README
@@ -0,0 +1,28 @@
The boxes come with:
- ports system already installed
- puppet and chef
- check the postinstall.sh script to see what is built in the box on top of the default install
- add/remove to your heart's content

a. Easy to use boxes for experimentation
- with puppet
- with chef
- with whatever else you can dream of :)

b. Mount
# freebsd mouting NFS patch for FreeBSD
# https://github.com/mitchellh/vagrant/commit/8a0a1bddb5afc6b99cab595d6f3cc9a95bb1a509
# OpenBSD will need patching to use it as NFS host
From the validation steps just the mount step fails
Virtualbox mount can be achieved using NFS mounts, it is not possible using the VBox tools since you can't compile them on OpenBSD
1. you can have your host expose NFS mounts that can be mounted by the Openbsd guest (checkout the vagrant documentation on using NFS mounts)
2. another way can be to work with vagrant in Puppet-server / chef-server mode since it will get manifests over the network from the puppet/chef server.
3. use a shell provisioner and scp/rsync your manifests from the host to the guest


c. Wait times
I've commented in all the steps in the OpenBSD install (definitions.rb)
Adjust the <Wait> times if your machine is slower/faster than those times.

d. More on puppet usage with OpenBSD
# http://puppetlabs.com/blog/guest-post-a-puffy-in-the-corporate-aquarium-the-sequel/
85 changes: 85 additions & 0 deletions templates/openbsd52_amd64/definition.rb
@@ -0,0 +1,85 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '256',
:disk_size => '40960', :disk_format => 'VDI', :hostiocache => 'off',
:os_type_id => 'OpenBSD_64',
:iso_file => "openbsd52_64.iso",
:iso_src => "http://ftp3.usa.openbsd.org/pub/OpenBSD/5.2/amd64/install52.iso",
:iso_md5 => "a10f51d910052b477147e198c08089f8",
:iso_download_timeout => "1000",
:boot_wait => "40", :boot_cmd_sequence => [
# I - install
'I<Enter>',
# set the keyboard
'us<Enter>',
# set the hostname
'OpenBSD52-x64<Enter>',
# Which nic to config ? [em0]
'<Enter>',
# do you want dhcp ? [dhcp]
'<Enter>',
'<Wait>'*5,
# IPV6 for em0 ? [none]
'none<Enter>',
# Which other nic do you wish to configure [done]
'done<Enter>',
# Pw for root account
'vagrant<Enter>',
'vagrant<Enter>',
# Start sshd by default ? [yes]
'yes<Enter>',
# Start ntpd by default ? [yes]
'no<Enter>',
# Do you want the X window system [yes]
'no<Enter>',
# Setup a user ?
'vagrant<Enter>',
# Full username
'vagrant<Enter>',
# Pw for this user
'vagrant<Enter>',
'vagrant<Enter>',
# Do you want to disable sshd for root ? [yes]
'no<Enter>',
# What timezone are you in ?
'GB<Enter>',
# Available disks [sd0]
'<Enter>',
# Use DUIDs rather than device names in fstab ? [yes]
'<Enter>',
# Use (W)whole disk or (E)edit MBR ? [whole]
'W<Enter>',
# Use (A)auto layout ... ? [a]
'A<Enter>',
'<Wait>'*60,
# location of the sets [cd]
'cd<Enter>',
# Available cd-roms : cd0
'<Enter>',
# Pathneame to sets ? [5.2/amd64]
'<Enter>',
# Remove games and X
'-game52.tgz<Enter>',
'-xbase52.tgz<Enter>',
'-xetc52.tgz<Enter>',
'-xshare52.tgz<Enter>',
'-xfont52.tgz<Enter>',
'-xserv52.tgz<Enter>',
'done<Enter>',
'<Wait>'*90,
# Done installing ?
'done<Enter>',
# Time appears wrong. Set to ...? [yes]
'yes<Enter><Wait>',
'<Wait>'*6,
# Install non-free firmware files on first boot ? [no] <-- don't know what this is so I'm saying no
'no<Enter><Wait>',
'reboot<Enter>',
'<Wait>'*6
],
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "",
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "sh '%f'",
:shutdown_cmd => "/sbin/halt -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
})
81 changes: 81 additions & 0 deletions templates/openbsd52_amd64/postinstall.sh
@@ -0,0 +1,81 @@
# set pkg path for users
echo " "
echo " Setting PKG_PATH for users "
echo " "
echo " export PKG_PATH=http://ftp3.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/ " >> /root/.profile
echo " export PKG_PATH=http://ftp3.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/ ">> /home/vagrant/.profile

# giving root & vagrant bash as shell
echo " "
echo " Giving root/vagrant bash as a shell "
echo " "
usermod -s /usr/local/bin/bash vagrant
usermod -s /usr/local/bin/bash root

# install wget/curl/bash/vim and its dependencies
echo " "
echo " Installing needed packages "
echo " "
export PKG_PATH=http://ftp3.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/
pkg_add wget curl bash vim-7.3.154p2-no_x11 rsync-3.0.9 bzip2 ngrep
pkg_add ruby-1.9.3.194
pkg_add ruby-gems
ln -sf /usr/local/bin/gem19 /usr/local/bin/gem

ln -sf /usr/local/bin/ruby19 /usr/local/bin/ruby
ln -sf /usr/local/bin/erb19 /usr/local/bin/erb
ln -sf /usr/local/bin/irb19 /usr/local/bin/irb
ln -sf /usr/local/bin/rdoc19 /usr/local/bin/rdoc
ln -sf /usr/local/bin/ri19 /usr/local/bin/ri
ln -sf /usr/local/bin/testrb19 /usr/local/bin/testrb

pkg_add ruby-iconv
pkg_add ruby-puppet-2.7.14

gem install chef --no-ri --no-rdoc


/etc/rc.d/sendmail stop

# Create puppet user/group
echo " "
echo " Creating puppet user / group "
echo " "
groupadd puppet
useradd -g puppet -d /var/lib/puppet -s /usr/bin/false puppet


# install the ports system for who wants to use it
echo " "
echo " Installing the ports system ! "
echo " "
cd /tmp
wget http://ftp3.usa.openbsd.org/pub/OpenBSD/`uname -r`/ports.tar.gz
cd /usr
sudo tar xzf /tmp/ports.tar.gz

# sudo
# Defaults requiretty is not present in the sudoers file
# env_keep I'll leave it as it is since user's path is same or more comprehensive than root's path
echo " "
echo " Setting sudo to work with vagrant "
echo " "
echo "# Uncomment to allow people in group wheel to run all commands without a password" >> /etc/sudoers
echo "%wheel ALL=(ALL) NOPASSWD: SETENV: ALL" >> /etc/sudoers

# setup the vagrant key
# you can replace this key-pair with your own generated ssh key-pair
echo " "
echo " Setting the vagrant ssh pub key "
echo " "
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
chown vagrant.vagrant /home/vagrant/.ssh
touch /home/vagrant/.ssh/authorized_keys
curl -sL http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub > /home/vagrant/.ssh/authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown vagrant.vagrant /home/vagrant/.ssh/authorized_keys

echo
echo "Post-install done"
exit 0
28 changes: 28 additions & 0 deletions templates/openbsd52_i386/README
@@ -0,0 +1,28 @@
The boxes come with:
- ports system already installed
- puppet and chef
- check the postinstall.sh script to see what is built in the box on top of the default install
- add/remove to your heart's content

a. Easy to use boxes for experimentation
- with puppet
- with chef
- with whatever else you can dream of :)

b. Mount
# freebsd mouting NFS patch for FreeBSD
# https://github.com/mitchellh/vagrant/commit/8a0a1bddb5afc6b99cab595d6f3cc9a95bb1a509
# OpenBSD will need patching to use it as NFS host
From the validation steps just the mount step fails
Virtualbox mount can be achieved using NFS mounts, it is not possible using the VBox tools since you can't compile them on OpenBSD
1. you can have your host expose NFS mounts that can be mounted by the Openbsd guest (checkout the vagrant documentation on using NFS mounts)
2. another way can be to work with vagrant in Puppet-server / chef-server mode since it will get manifests over the network from the puppet/chef server.
3. use a shell provisioner and scp/rsync your manifests from the host to the guest


c. Wait times
I've commented in all the steps in the OpenBSD install (definitions.rb)
Adjust the <Wait> times if your machine is slower/faster than those times.

d. More on puppet usage with OpenBSD
# http://puppetlabs.com/blog/guest-post-a-puffy-in-the-corporate-aquarium-the-sequel/
85 changes: 85 additions & 0 deletions templates/openbsd52_i386/definition.rb
@@ -0,0 +1,85 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '256',
:disk_size => '40960', :disk_format => 'VDI', :hostiocache => 'off',
:os_type_id => 'OpenBSD_32',
:iso_file => "openbsd52_32.iso",
:iso_src => "http://ftp3.usa.openbsd.org/pub/OpenBSD/5.2/i386/install52.iso",
:iso_md5 => "a10f51d910052b477147e198c08089f8",
:iso_download_timeout => "1000",
:boot_wait => "40", :boot_cmd_sequence => [
# I - install
'I<Enter>',
# set the keyboard
'us<Enter>',
# set the hostname
'OpenBSD52-x32<Enter>',
# Which nic to config ? [em0]
'<Enter>',
# do you want dhcp ? [dhcp]
'<Enter>',
'<Wait>'*5,
# IPV6 for em0 ? [none]
'none<Enter>',
# Which other nic do you wish to configure [done]
'done<Enter>',
# Pw for root account
'vagrant<Enter>',
'vagrant<Enter>',
# Start sshd by default ? [yes]
'yes<Enter>',
# Start ntpd by default ? [yes]
'no<Enter>',
# Do you want the X window system [yes]
'no<Enter>',
# Setup a user ?
'vagrant<Enter>',
# Full username
'vagrant<Enter>',
# Pw for this user
'vagrant<Enter>',
'vagrant<Enter>',
# Do you want to disable sshd for root ? [yes]
'no<Enter>',
# What timezone are you in ?
'GB<Enter>',
# Available disks [sd0]
'<Enter>',
# Use DUIDs rather than device names in fstab ? [yes]
'<Enter>',
# Use (W)whole disk or (E)edit MBR ? [whole]
'W<Enter>',
# Use (A)auto layout ... ? [a]
'A<Enter>',
'<Wait>'*60,
# location of the sets [cd]
'cd<Enter>',
# Available cd-roms : cd0
'<Enter>',
# Pathneame to sets ? [5.2/i386]
'<Enter>',
# Remove games and X
'-game52.tgz<Enter>',
'-xbase52.tgz<Enter>',
'-xetc52.tgz<Enter>',
'-xshare52.tgz<Enter>',
'-xfont52.tgz<Enter>',
'-xserv52.tgz<Enter>',
'done<Enter>',
'<Wait>'*90,
# Done installing ?
'done<Enter>',
# Time appears wrong. Set to ...? [yes]
'yes<Enter><Wait>',
'<Wait>'*6,
# Install non-free firmware files on first boot ? [no] <-- don't know what this is so I'm saying no
'no<Enter><Wait>',
'reboot<Enter>',
'<Wait>'*6
],
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "",
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "sh '%f'",
:shutdown_cmd => "/sbin/halt -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
})

0 comments on commit 71176b0

Please sign in to comment.