hetzner-bootstrap 1.1.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: eff15025048cd8199756563698df5a855c06777e0f0f8c7a8884e2257c72eb6a
4
+ data.tar.gz: 35ff4df9030ee5ba633cd1705c6f28832abdc961bbbf0b288cc8cea7da6449ba
5
+ SHA512:
6
+ metadata.gz: c9647374e2023da42678d7aaa50c37847405cb08ac15098e4aae95ea8253d7e7ad7523e9873a6447c8d8112f4cbc6930b4c5ad66b146815a18aa9acb25dae1e6
7
+ data.tar.gz: 6ed659e4df52fb0ee1dc746519ee59573b05b088b17e29307d1f7cf0a758556b9f921647901a15cca038518ddda9e0b1d7b7d83e26620cbc66a37a7c28d001ea
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+
5
+ Layout/LineLength:
6
+ Enabled: false
7
+
8
+ Metrics/MethodLength:
9
+ Enabled: false
10
+
11
+ Naming/FileName:
12
+ Enabled: false
13
+
14
+ Style/Documentation:
15
+ Enabled: false
16
+
17
+ Metrics/ClassLength:
18
+ Enabled: false
19
+
20
+ Metrics/AbcSize:
21
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.0
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in hetzner.gemspec
4
6
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Moriz GmbH, Roland Moriz, http://moriz.de/
1
+ Copyright (c) 2019 Moriz GmbH, Roland Moriz, http://moriz.de/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,6 +3,8 @@ hetzner-bootstrap
3
3
 
4
4
  hetzner-bootstrap allows you to bootstrap a provisioned EQ Server from hetzner.de
5
5
 
6
+ [![Gem Version](https://badge.fury.io/rb/hetzner-bootstrap.png)](http://badge.fury.io/rb/hetzner-bootstrap)
7
+
6
8
  What it does:
7
9
  -------------
8
10
 
@@ -38,6 +40,117 @@ Example:
38
40
 
39
41
  Warning: All existing data on the system will be lost!
40
42
 
43
+
44
+
45
+ ```ruby
46
+
47
+ #!/usr/bin/env ruby
48
+ require 'hetzner-bootstrap'
49
+
50
+ bs = Hetzner::Bootstrap.new(api: Hetzner::API.new(ENV['ROBOT_USER'], ENV['ROBOT_PASSWORD']))
51
+
52
+ template = <<EOT
53
+ # see https://github.com/hetzneronline/installimage/
54
+ DRIVE1 /dev/sda
55
+ DRIVE2 /dev/sdb
56
+
57
+ ## activate software RAID? < 0 | 1 >
58
+ SWRAID 1
59
+
60
+ ## Choose the level for the software RAID < 0 | 1 >
61
+ SWRAIDLEVEL 1
62
+
63
+ ## which bootloader should be used? < lilo | grub >
64
+ BOOTLOADER grub
65
+
66
+ HOSTNAME <%= hostname %>
67
+
68
+ ## PART <mountpoint/lvm> <filesystem/VG> <size in MB>
69
+ ##
70
+ ## * <mountpoint/lvm> mountpoint for this filesystem *OR* keyword 'lvm'
71
+ ## to use this PART as volume group (VG) for LVM
72
+ ## * <filesystem/VG> can be ext2, ext3, reiserfs, xfs, swap *OR* name
73
+ ## of the LVM volume group (VG), if this PART is a VG
74
+ ## * <size> you can use the keyword 'all' to assign all the
75
+ ## remaining space of the drive to the *last* partition.
76
+ ## you can use M/G/T for unit specification in MIB/GIB/TIB
77
+ ##
78
+ ## notes:
79
+ ## - extended partitions are created automatically
80
+ ## - '/boot' cannot be on a xfs filesystem!
81
+ ## - '/boot' cannot be on LVM!
82
+ ## - when using software RAID 0, you need a '/boot' partition
83
+
84
+ PART /boot ext3 1G
85
+ PART lvm host 75G
86
+ PART lvm guest all
87
+
88
+ #LV <VG> <name> <mount> <filesystem> <size>
89
+ LV host root / ext4 50G
90
+ LV host swap swap swap 5G
91
+
92
+
93
+ ## ========================
94
+ ## OPERATING SYSTEM IMAGE:
95
+ ## ========================
96
+
97
+ ## full path to the operating system image
98
+ ## supported image sources: local dir, ftp, http, nfs
99
+ ## supported image types: tar, tar.gz, tar.bz, tar.bz2, tgz, tbz
100
+ ## examples:
101
+ #
102
+ # local: /path/to/image/filename.tar.gz
103
+ # ftp: ftp://<user>:<password>@hostname/path/to/image/filename.tar.bz2
104
+ # http: http://<user>:<password>@hostname/path/to/image/filename.tbz
105
+ # https: https://<user>:<password>@hostname/path/to/image/filename.tbz
106
+ # nfs: hostname:/path/to/image/filename.tgz
107
+
108
+ # Default images provided by hetzner as of October 2014:
109
+ # Archlinux-2014-64-minmal.tar.gz
110
+ # CentOS-65-32-minimal.tar.gz
111
+ # CentOS-65-64-cpanel.tar.gz
112
+ # CentOS-65-64-minimal.tar.gz
113
+ # CentOS-70-64-minimal.tar.gz
114
+ # Debian-76-wheezy-32-minimal.tar.gz
115
+ # Debian-76-wheezy-64-LAMP.tar.gz
116
+ # Debian-76-wheezy-64-minimal.tar.gz
117
+ # openSUSE-131-64-minimal.tar.gz
118
+ # Ubuntu-1204-precise-64-minimal.tar.gz
119
+ # Ubuntu-1404-trusty-64-minimal.tar.gz
120
+
121
+
122
+ IMAGE /root/images/Ubuntu-1404-trusty-64-minimal.tar.gz
123
+
124
+ EOT
125
+
126
+ # the post_install hook is a great place to setup further software/system provisioning
127
+ #
128
+ post_install = <<EOT
129
+ # knife bootstrap <%= ip %> -N <%= hostname %> "role[base],role[kvm_host]"
130
+ EOT
131
+
132
+ bs << {
133
+ ip: '1.2.3.4',
134
+ template: template, # string will be parsed by erubis
135
+ hostname: 'server100.example.com', # will be used for setting the systems' hostname
136
+ public_keys: "~/.ssh/id_dsa.pub", # will be copied over to the freshly bootstrapped system
137
+ post_install: post_install # will be called locally at the end and can be used e.g. to run a chef bootstrap
138
+ }
139
+
140
+ bs << {
141
+ ip: '1.2.3.5',
142
+ template: template, # string will be parsed by erubis
143
+ hostname: 'server101.example.com', # will be used for setting the systems' hostname
144
+ public_keys: "~/.ssh/id_dsa.pub", # will be copied over to the freshly bootstrapped system
145
+ post_install: post_install # will be called locally at the end and can be used e.g. to run a chef bootstrap
146
+ }
147
+
148
+ ...
149
+ bs.bootstrap!
150
+
151
+
152
+ ```
153
+
41
154
  Installation:
42
155
  -------------
43
156
 
@@ -47,20 +160,13 @@ Warnings:
47
160
  ---------
48
161
 
49
162
  * All existing data on the system will be wiped on bootstrap!
50
- * This is not an official Hetzner AG project.
51
- * The gem and the author are not related to Hetzner AG!
163
+ * This is not an official Hetzner Online GmbH project.
164
+ * The gem and the author are not related to Hetzner Online GmbH !
52
165
 
53
166
  **Use at your very own risk. Satisfaction is NOT guaranteed.**
54
167
 
55
- Commercial Support available through:
56
- -------------------------------------
57
-
58
- [![Moriz GmbH](https://moriz.de/images/logo.png)](http://moriz.de/)
59
-
60
- [Moriz GmbH, München](http://moriz.de/)
61
-
62
168
 
63
169
  Copyright
64
170
  ---------
65
171
 
66
- Copyright (c) 2011 Moriz GmbH, Roland Moriz. See LICENSE file for details.
172
+ Copyright © 2019 [Roland Moriz](https://roland.io), [Moriz GmbH](https://moriz.de/)
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
data/example.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- require "rubygems"
3
- require "hetzner-bootstrap"
2
+ # frozen_string_literal: true
3
+
4
+ require 'rubygems'
5
+ require 'hetzner-bootstrap'
4
6
 
5
7
  # get your API login from Hetzner's customer panel at: https://robot.your-server.de/
6
8
  # assign env variables:
@@ -10,105 +12,102 @@ require "hetzner-bootstrap"
10
12
  # rbenv-tip: checkout rbenv-vars, it's awesome!
11
13
  # https://github.com/sstephenson/rbenv-vars/
12
14
 
13
- bs = Hetzner::Bootstrap.new :api => Hetzner::API.new(ENV['ROBOT_USER'], ENV['ROBOT_PASSWORD'])
15
+ bs = Hetzner::Bootstrap.new(api: Hetzner::API.new(
16
+ ENV['ROBOT_USER'],
17
+ ENV['ROBOT_PASSWORD']
18
+ ))
14
19
 
15
20
  # 2 disks, software raid 1, etc.
16
- template = <<EOT
17
- DRIVE1 /dev/sda
18
- DRIVE2 /dev/sdb
19
- FORMATDRIVE2 0
20
-
21
- ## ===============
22
- ## SOFTWARE RAID:
23
- ## ===============
24
-
25
- ## activate software RAID? < 0 | 1 >
26
- SWRAID 1
27
-
28
- ## Choose the level for the software RAID < 0 | 1 >
29
- SWRAIDLEVEL 1
30
-
31
- ## which bootloader should be used? < lilo | grub >
32
- BOOTLOADER grub
33
-
34
- HOSTNAME <%= hostname %>
35
-
36
- ## PART <mountpoint/lvm> <filesystem/VG> <size in MB>
37
- ##
38
- ## * <mountpoint/lvm> mountpoint for this filesystem *OR* keyword 'lvm'
39
- ## to use this PART as volume group (VG) for LVM
40
- ## * <filesystem/VG> can be ext2, ext3, reiserfs, xfs, swap *OR* name
41
- ## of the LVM volume group (VG), if this PART is a VG
42
- ## * <size> you can use the keyword 'all' to assign all the
43
- ## remaining space of the drive to the *last* partition.
44
- ## you can use M/G/T for unit specification in MIB/GIB/TIB
45
- ##
46
- ## notes:
47
- ## - extended partitions are created automatically
48
- ## - '/boot' cannot be on a xfs filesystem!
49
- ## - '/boot' cannot be on LVM!
50
- ## - when using software RAID 0, you need a '/boot' partition
51
-
52
- PART /boot ext2 1G
53
- PART lvm host 75G
54
- PART lvm guest all
55
-
56
- #LV <VG> <name> <mount> <filesystem> <size>
57
- LV host root / ext3 50G
58
- LV host swap swap swap 5G
59
-
60
-
61
- ## ========================
62
- ## OPERATING SYSTEM IMAGE:
63
- ## ========================
64
-
65
- ## full path to the operating system image
66
- ## supported image sources: local dir, ftp, http, nfs
67
- ## supported image types: tar, tar.gz, tar.bz, tar.bz2, tgz, tbz
68
- ## examples:
69
- #
70
- # local: /path/to/image/filename.tar.gz
71
- # ftp: ftp://<user>:<password>@hostname/path/to/image/filename.tar.bz2
72
- # http: http://<user>:<password>@hostname/path/to/image/filename.tbz
73
- # https: https://<user>:<password>@hostname/path/to/image/filename.tbz
74
- # nfs: hostname:/path/to/image/filename.tgz
75
-
76
- # Default images provided by hetzner as of August 2012:
77
- # CentOS-58-32-minimal.tar.gz
78
- # CentOS-58-64-minimal.tar.gz
79
- # CentOS-62-32-minimal.tar.gz
80
- # CentOS-62-64-cpanel.tar.gz
81
- # CentOS-62-64-minimal.tar.gz
82
- # CentOS-63-32-minimal.tar.gz
83
- # CentOS-63-64-cpanel.tar.gz
84
- # CentOS-63-64-minimal.tar.gz
85
- # Debian-60-squeeze-32-minimal.tar.gz
86
- # Debian-60-squeeze-64-LAMP.tar.gz
87
- # Debian-60-squeeze-64-minimal.tar.gz
88
- # openSUSE-121-32-minimal.tar.gz
89
- # openSUSE-121-64-minimal.tar.gz
90
- # Ubuntu-1004-lucid-32-minimal.tar.gz
91
- # Ubuntu-1004-lucid-64-minimal.tar.gz
92
- # Ubuntu-1204-precise-32-minimal.tar.gz
93
- # Ubuntu-1204-precise-64-minimal.tar.gz
94
-
95
-
96
- IMAGE /root/images/Ubuntu-1204-precise-64-minimal.tar.gz
97
-
98
- EOT
99
-
100
- # the post_install hook is a great place to setup further software/system provisioning
21
+ template = <<~END_OF_TEMPLATE
22
+ DRIVE1 /dev/sda
23
+ DRIVE2 /dev/sdb
24
+ FORMATDRIVE2 0
25
+
26
+ ## ===============
27
+ ## SOFTWARE RAID:
28
+ ## ===============
29
+
30
+ ## activate software RAID? < 0 | 1 >
31
+ SWRAID 1
32
+
33
+ ## Choose the level for the software RAID < 0 | 1 >
34
+ SWRAIDLEVEL 1
35
+
36
+ ## which bootloader should be used? < lilo | grub >
37
+ BOOTLOADER grub
38
+
39
+ HOSTNAME <%= hostname %>
40
+
41
+ ## PART <mountpoint/lvm> <filesystem/VG> <size in MB>
42
+ ##
43
+ ## * <mountpoint/lvm> mountpoint for this filesystem *OR* keyword 'lvm'
44
+ ## to use this PART as volume group (VG) for LVM
45
+ ## * <filesystem/VG> can be ext2, ext3, reiserfs, xfs, swap *OR* name
46
+ ## of the LVM volume group (VG), if this PART is a VG
47
+ ## * <size> you can use the keyword 'all' to assign all the
48
+ ## remaining space of the drive to the *last* partition.
49
+ ## you can use M/G/T for unit specification in MIB/GIB/TIB
50
+ ##
51
+ ## notes:
52
+ ## - extended partitions are created automatically
53
+ ## - '/boot' cannot be on a xfs filesystem!
54
+ ## - '/boot' cannot be on LVM!
55
+ ## - when using software RAID 0, you need a '/boot' partition
56
+
57
+ PART /boot ext2 1G
58
+ PART lvm host 75G
59
+ PART lvm guest all
60
+
61
+ #LV <VG> <name> <mount> <filesystem> <size>
62
+ LV host root / ext3 50G
63
+ LV host swap swap swap 5G
64
+
65
+
66
+ ## ========================
67
+ ## OPERATING SYSTEM IMAGE:
68
+ ## ========================
69
+
70
+ ## full path to the operating system image
71
+ ## supported image sources: local dir, ftp, http, nfs
72
+ ## supported image types: tar, tar.gz, tar.bz, tar.bz2, tgz, tbz
73
+ ## examples:
74
+ #
75
+ # local: /path/to/image/filename.tar.gz
76
+ # ftp: ftp://<user>:<password>@hostname/path/to/image/filename.tar.bz2
77
+ # http: http://<user>:<password>@hostname/path/to/image/filename.tbz
78
+ # https: https://<user>:<password>@hostname/path/to/image/filename.tbz
79
+ # nfs: hostname:/path/to/image/filename.tgz
80
+
81
+ # Default images provided by hetzner as of October 2014:
82
+ # Archlinux-2014-64-minmal.tar.gz
83
+ # CentOS-65-32-minimal.tar.gz
84
+ # CentOS-65-64-cpanel.tar.gz
85
+ # CentOS-65-64-minimal.tar.gz
86
+ # CentOS-70-64-minimal.tar.gz
87
+ # Debian-76-wheezy-32-minimal.tar.gz
88
+ # Debian-76-wheezy-64-LAMP.tar.gz
89
+ # Debian-76-wheezy-64-minimal.tar.gz
90
+ # openSUSE-131-64-minimal.tar.gz
91
+ # Ubuntu-1204-precise-64-minimal.tar.gz
92
+ # Ubuntu-1404-trusty-64-minimal.tar.gz
93
+
94
+
95
+ IMAGE /root/images/Ubuntu-1204-precise-64-minimal.tar.gz
96
+
97
+ END_OF_TEMPLATE
98
+
99
+ # the post_install hook is a great place to setup further
100
+ # software/system provisioning
101
101
  #
102
- post_install = <<EOT
102
+ post_install = <<END_OF_POST_INSTALL
103
103
  # knife bootstrap <%= ip %> -N <%= hostname %> "role[base],role[kvm_host]"
104
- EOT
104
+ END_OF_POST_INSTALL
105
105
 
106
106
  # duplicate entry for each system
107
- bs << { :ip => "1.2.3.4",
108
- :template => template, # string will be parsed by erubis
109
- :hostname => 'server100.example.com', # will be used for setting the systems' hostname
110
- :public_keys => "~/.ssh/id_dsa.pub", # will be copied over to the freshly bootstrapped system
111
- :post_install => post_install } # will be called locally at the end and can be used e.g. to run a chef bootstrap
107
+ bs << { ip: '1.2.3.4',
108
+ template: template, # string will be parsed by erubis
109
+ hostname: 'server100', # sets hostname
110
+ public_keys: '~/.ssh/id_dsa.pub', # will be copied to your system
111
+ post_install: post_install } # will be executed *locally* at the end
112
112
 
113
113
  bs.bootstrap!
114
-
@@ -1,26 +1,34 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "hetzner/bootstrap/version"
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+ require 'hetzner/bootstrap/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "hetzner-bootstrap"
7
+ s.name = 'hetzner-bootstrap'
7
8
  s.version = Hetzner::Bootstrap::VERSION
8
9
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Roland Moriz"]
10
- s.email = ["roland@moriz.de"]
11
- s.homepage = "http://moriz.de/opensource/hetzner-api"
12
- s.summary = %q{Easy bootstrapping of hetzner.de rootservers using hetzner-api}
13
- s.description = %q{Easy bootstrapping of hetzner.de rootservers using hetzner-api}
10
+ s.authors = ['Roland Moriz']
11
+ s.email = ['roland@moriz.de']
12
+ s.homepage = 'https://github.com/rmoriz/hetzner-bootstrap'
13
+ s.summary = 'Easy bootstrapping of hetzner.de rootservers using hetzner-api'
14
+ s.description = 'Easy bootstrapping of hetzner.de rootservers using hetzner-api'
14
15
 
16
+ s.required_ruby_version = '~> 3.0'
17
+ s.add_dependency 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
18
+ s.add_dependency 'ed25519', '>= 1.2', '< 2.0'
19
+ s.add_dependency 'erubis', '>= 2.7.0'
15
20
  s.add_dependency 'hetzner-api', '>= 1.1.0'
16
- s.add_dependency 'net-ssh', '>= 2.6.0'
17
- s.add_dependency 'erubis', '>= 2.7.0'
21
+ s.add_dependency 'net-ssh', '~> 6.1'
22
+ s.add_dependency 'rexml'
18
23
 
19
- s.add_development_dependency "rspec", ">= 2.13.0"
20
- s.add_development_dependency "rake"
24
+ s.add_development_dependency 'rake'
25
+ s.add_development_dependency 'rspec', '~> 3.4.0'
26
+ s.add_development_dependency 'rubocop', '~> 1.10'
27
+ s.add_development_dependency 'rubocop-rake'
28
+ s.add_development_dependency 'rubocop-rspec'
21
29
 
22
30
  s.files = `git ls-files`.split("\n")
23
31
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
- s.require_paths = ["lib"]
32
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
33
+ s.require_paths = ['lib']
26
34
  end