hetzner-bootstrap-coreos

This gem allows you to bootstrap CoreOS on a Hetzner root server.

Gem Version

What it does:

In our case we are running a large CoreOS cluster and which uses bare metal servers hosted at Hetzner. This Ruby gem helps to fully automate the provisioning of CoreOS on a Hetzner root server.

Warning: All existing data on the system will be lost!

Requirements:

First of all retrieve your API login credentials from the Hetzner admin interface at https://robot.your-server.de. Additionally you need the IP address of the shipped system.

Implemented steps:

  1. Enable Rescue Mode (using Hetzner's webservice)
  2. Resetting the System to boot into rescue mode (using Hetzner's webservice)
  3. Log into the rescue system, write your cloud config file and launch the installation
  4. Reboot
  5. Verify installation (very basic check but can be overwritten)
  6. Copy your local ssh public-key into root's .authorized_keys
  7. Adds the generated server key into your .know_hosts file
  8. Execute post_install hooks (optional)

Example:

see example.rb file for usage!

Warning: All existing data on the system will be lost!


#!/usr/bin/env ruby
require "rubygems"
require "hetzner-bootstrap-coreos"

# Retrieve your API login credentials from the Hetzner admin interface
# at https://robot.your-server.de and assign the appropriate environment
# variables ENV['ROBOT_USER'] and ENV['ROBOT_PASSWORD']

bs = Hetzner::Bootstrap::CoreOS.new(
  :api => Hetzner::API.new(ENV['ROBOT_USER'], ENV['ROBOT_PASSWORD'])
)

# Main configuration (cloud-config) 
cloud_config = <<EOT
hostname: <%= hostname %>
ssh_authorized_keys:
  - <%= public_keys %>
EOT

# The post_install hook is the right place to launch further tasks (e.g.
# software installation, system provisioning etc.)
post_install = <<EOT
  # TODO
EOT

bs << { :ip => "1.2.3.4",
  :cloud_config => cloud_config,
  :hostname => 'artemis.massive-insights.com',
    :public_keys => "~/.ssh/id_dsa.pub",
    :post_install => post_install
}

bs.bootstrap!

Installation:

gem install hetzner-bootstrap-coreos

Warnings:

  • All existing data on the system will be wiped on bootstrap!
  • This is not an official Hetzner AG project.
  • The gem and the author are not related to Hetzner AG!

Use at your very own risk. Satisfaction is NOT guaranteed.

Thank you greeting

This Ruby gem is inspired by the hetzner-bootstrap gem and requires the underlying wrapper for the Hetzner server management API hetzner-api. Thus I want to thank Roland Moriz a lot for his great work!

Copyright © 2014 Christoph Pilka (Asconix Systems AS