-
Notifications
You must be signed in to change notification settings - Fork 17
Example
rmoriz edited this page Feb 11, 2011
·
1 revision
#!/usr/bin/env ruby
require "rubygems"
require "hetzner-bootstrap"
# Webservice login => as a Hetzner customer, get one at: https://robot.your-server.de
API_USERNAME="AAAAAAAAAAAAAA"
API_PASSWORD="BBBBBBBBBBBBBB"
bs = Hetzner::Bootstrap.new :api => Hetzner::API.new(API_USERNAME, API_PASSWORD)
template = <<EOT
DRIVE1 /dev/sda
DRIVE2 /dev/sdb
FORMATDRIVE2 0
SWRAID 1
SWRAIDLEVEL 1
BOOTLOADER grub
HOSTNAME <%= hostname %>
PART /boot ext2 1G
PART lvm host 75G
PART lvm guest all
LV host root / ext3 50G
LV host swap swap swap 5G
IMAGE /root/images/Ubuntu-1010-maverick-64-minimal.tar.gz
EOT
post_install = <<EOT
echo "lala!"
EOT
bs << { :ip => "46.123.123.123",
:template => template,
:hostname => 'test.asdas.net',
:public_keys => "~/.ssh/id_dsa.pub",
:post_install => post_install }
bs.bootstrap!$ bundle exec ./bin/bootstrap_example
[21:27:52][46.123.123.123 ][enable_rescue_mode] START
[21:27:53][46.123.123.123 ][enable_rescue_mode] IP: 46.123.123.123 => password: lRFW452%
[21:27:53][46.123.123.123 ][enable_rescue_mode] FINISHED in 1.07725 seconds
[21:27:53][46.123.123.123 ][reset] START
[21:27:54][46.123.123.123 ][reset] FINISHED in 0.38539 seconds
[21:27:54][46.123.123.123 ][wait_for_ssh_down] START
[21:27:56][46.123.123.123 ][wait_for_ssh_down] SSH UP
[21:27:58][46.123.123.123 ][wait_for_ssh_down] SSH UP
[21:28:00][46.123.123.123 ][wait_for_ssh_down] SSH UP
[21:28:02][46.123.123.123 ][wait_for_ssh_down] SSH UP
[21:28:08][46.123.123.123 ][wait_for_ssh_down] SSH DOWN
[21:28:08][46.123.123.123 ][wait_for_ssh_down] FINISHED in 14.18642 seconds
[21:28:08][46.123.123.123 ][wait_for_ssh_up] START
[21:28:12][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:18][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:24][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:30][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:36][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:42][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:48][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:50][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:54][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:56][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:28:58][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:29:00][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:29:02][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:29:04][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:29:06][46.123.123.123 ][wait_for_ssh_up] SSH UP
[21:29:06][46.123.123.123 ][wait_for_ssh_up] FINISHED in 58.21207 seconds
[21:29:06][46.123.123.123 ][installimage] START
[21:29:07][46.123.123.123 ][installimage] remote executing: /root/.oldroot/nfs/install/installimage -a -c /tmp/template
[21:31:25][46.123.123.123 ][installimage] TERM environment variable not set.
Found AUTOSETUP file '/autosetup'
Running unattended installimage installation ...
DRIVE1 /dev/sda
DRIVE2 /dev/sdb
FORMATDRIVE2 0
SWRAID 1
SWRAIDLEVEL 1
BOOTLOADER grub
HOSTNAME test.asdas.net
PART /boot ext2 1G
PART lvm host 75G
PART lvm guest all
LV host root / ext3 50G
LV host swap swap swap 5G
IMAGE /root/images/Ubuntu-1010-maverick-64-minimal.tar.gz
WARNING:
Starting installation in 20 seconds ...
Press X to continue immediately ...
Installation will DELETE ALL DATA ON DISK(s)!
Press CTRL-C to abort now!
=> ....................
TERM environment variable not set.
Hetzner Online AG - installimage
Your server will be installed now, this will take some minutes
You can abort at any time with CTRL+C ...
: Reading configuration done
1/14 : Deleting partitions done
2/14 : Creating partitions and /etc/fstab done
3/14 : Creating software RAID level 1 done
4/14 : Creating LVM volumes done
5/14 : Formatting partitions
: formatting /dev/md0 with ext2 done
: formatting /dev/host/root with ext3 done
: formatting /dev/host/swap with swap done
6/14 : Mounting partitions done
7/14 : Extracting image (local) done
8/14 : Setting up network for eth0 done
9/14 : Executing additional commands
: Generating new SSH keys done
: Generating mdadm config done
: Generating ramdisk done
: Generating ntp config done
: Setting hostname done
10/14 : Setting up miscellaneous files done
11/14 : Setting root password done
12/14 : Installing bootloader grub done
13/14 : Running some ubuntu specific functions done
14/14 : Clearing log files done
INSTALLATION COMPLETE
You can now reboot and log in to your new system with
the same password as you logged in to the rescue system.
[21:31:25][46.123.123.123 ][installimage] FINISHED in 139.15399 seconds
[21:31:25][46.123.123.123 ][reboot] START
[21:31:25][46.123.123.123 ][reboot] FINISHED in 0.39184 seconds
[21:31:25][46.123.123.123 ][wait_for_ssh_down] START
[21:31:27][46.123.123.123 ][wait_for_ssh_down] SSH DOWN
[21:31:27][46.123.123.123 ][wait_for_ssh_down] FINISHED in 2.02765 seconds
[21:31:27][46.123.123.123 ][wait_for_ssh_up] START
[21:31:28][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:31:30][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:31:36][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:31:42][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:31:48][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:31:54][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:00][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:06][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:12][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:18][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:24][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:30][46.123.123.123 ][wait_for_ssh_up] SSH DOWN
[21:32:32][46.123.123.123 ][wait_for_ssh_up] SSH UP
[21:32:32][46.123.123.123 ][wait_for_ssh_up] FINISHED in 64.14466 seconds
[21:32:32][46.123.123.123 ][verify_installation] START
[21:32:32][46.123.123.123 ][verify_installation] FINISHED in 0.47672 seconds
[21:32:32][46.123.123.123 ][copy_ssh_keys] START
[21:32:33][46.123.123.123 ][copy_ssh_keys] FINISHED in 0.47096 seconds
[21:32:33][46.123.123.123 ][update_local_known_hosts] START
[21:32:33][46.123.123.123 ][update_local_known_hosts] remote host key added to local ~/.ssh/known_hosts file.
[21:32:33][46.123.123.123 ][update_local_known_hosts] FINISHED in 0.20695 seconds
[21:32:33][46.123.123.123 ][post_install] START
[21:32:33][46.123.123.123 ][post_install] executing post_install
[21:32:33][46.123.123.123 ][post_install] lala!
[21:32:33][46.123.123.123 ][post_install] FINISHED in 0.00514 seconds