dust-deploy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +95 -5
- data/bin/dust +19 -0
- data/dust.gemspec +1 -1
- data/lib/dust/examples/nodes/_debian.yaml +9 -0
- data/lib/dust/examples/nodes/_default.yaml +3 -0
- data/lib/dust/examples/nodes/example.yaml +5 -0
- data/lib/dust/recipes/newrelic.rb +20 -0
- data/lib/dust/version.rb +1 -1
- metadata +7 -3
data/README.md
CHANGED
@@ -11,7 +11,8 @@ installing
|
|
11
11
|
------------
|
12
12
|
|
13
13
|
installation is quite simple. just
|
14
|
-
|
14
|
+
|
15
|
+
# gem install dust-deploy
|
15
16
|
|
16
17
|
|
17
18
|
using
|
@@ -27,7 +28,7 @@ then, create directories you might/will need. (there's going to be an automation
|
|
27
28
|
$ mkdir templates
|
28
29
|
$ mkdir nodes
|
29
30
|
|
30
|
-
in the nodes directory, there will be your templates and node
|
31
|
+
in the nodes directory, there will be your node-templates and node configuration files.
|
31
32
|
dust uses simple .yaml files for configuring your nodes.
|
32
33
|
let's start by adding a simple host:
|
33
34
|
|
@@ -45,7 +46,7 @@ and put in basic information:
|
|
45
46
|
port: 22
|
46
47
|
user: root
|
47
48
|
|
48
|
-
# because this alone won't tell dust what to do, let's for example install
|
49
|
+
# because this alone won't tell dust what to do, let's for example install some useful packages
|
49
50
|
recipes:
|
50
51
|
packages: [ 'vim', 'git-core', 'rsync' ]
|
51
52
|
|
@@ -64,7 +65,7 @@ you can then save the file, and tell dust to get to work:
|
|
64
65
|
|
65
66
|
you should see dust connecting to the node, checking if the requestet packages are installed, and if not, install them.
|
66
67
|
dust works with aptitude, yum and emerge systems at the moment (testet with ubuntu, debian, gentoo, scientificlinux, centos).
|
67
|
-
feel free to contribute to dust, so that your system is also
|
68
|
+
feel free to contribute to dust, so that your system is also supported. contribution is easy! just send me a github pull request. You can find the repository here: https://github.com/kechagia/dust-deploy
|
68
69
|
|
69
70
|
|
70
71
|
inheritance
|
@@ -113,6 +114,8 @@ you can then inherit these templates in your yourhost.yaml:
|
|
113
114
|
running dust now, will use the inherited settings as well.
|
114
115
|
you can also overwrite settings in the template with the ones in yourhost.yaml
|
115
116
|
|
117
|
+
**NOTE** hashes will be deep merged with inherited hashes, other types will be overwritten!
|
118
|
+
|
116
119
|
$ dust deploy
|
117
120
|
|
118
121
|
[ yourhost ]
|
@@ -141,14 +144,101 @@ you can also overwrite settings in the template with the ones in yourhost.yaml
|
|
141
144
|
using recipes (and their templates)
|
142
145
|
------------
|
143
146
|
|
147
|
+
dust comes with a set of predifined, (almost) ready to use recipes managing a lot of stuff for you, including the following:
|
148
|
+
|
149
|
+
- ssh authorized keys
|
150
|
+
- email aliases file
|
151
|
+
- /etc/hosts
|
152
|
+
- /etc/motd
|
153
|
+
- /etc/resolv.conf
|
154
|
+
- install basic system tools and pushing .configuration files for root
|
155
|
+
- iptables firewall
|
156
|
+
- debian/ubuntu debsecan security notifications
|
157
|
+
- debian/ubunto repositories
|
158
|
+
- duplicity backups
|
159
|
+
- mysql server configuration
|
160
|
+
- postgresql server configuration (including corosync scripts)
|
161
|
+
- nginx configuration
|
162
|
+
- zabbix agent
|
163
|
+
- debian/ubuntu unattended upgrades
|
164
|
+
- newrelic system monitoring daemon
|
165
|
+
|
144
166
|
|
145
167
|
writing your own recipes
|
146
168
|
------------
|
147
169
|
|
170
|
+
because the above recipes will probably not in all cases fullfill your needs, it's pretty easy to write your own recipes. You can either file them in using a git pull request (if you think it's a generic one which others might use as well), or place them locally in the "recipes" folder in your mynetwork.dust directory.
|
171
|
+
|
172
|
+
dust comes with a set of predifined functions to perform system taks, which you can (and should!) use.
|
173
|
+
|
174
|
+
### the server.rb methods you can (and should!) use
|
175
|
+
|
176
|
+
almost all functions understand the quiet=true and indend=integer arguments
|
177
|
+
|
178
|
+
#### exec command
|
179
|
+
#### write target, text, quiet=false, indent=1
|
180
|
+
#### append target, text, quiet=false, indent=1
|
181
|
+
#### scp source, destination, quiet=false, indent=1
|
182
|
+
#### symlink source, destination, quiet=false, indent=1
|
183
|
+
#### chmod mode, file, quiet=false, indent=1
|
184
|
+
#### chown user, file, quiet=false, indent=1
|
185
|
+
#### rm file, quiet=false, indent=1
|
186
|
+
#### mkdir dir, quiet=false, indent=1
|
187
|
+
#### restorecon path, quiet=false, indent=1
|
188
|
+
#### get_system_users quiet=false
|
189
|
+
#### package_installed? packages, quiet=false, indent=1
|
190
|
+
#### install_package package, quiet=false, indent=1, env=""
|
191
|
+
#### update_repos quiet=false, indent=1
|
192
|
+
#### system_update quiet=false, indent=1
|
193
|
+
#### uses_apt? quiet=false, indent=1
|
194
|
+
#### uses_rpm? quiet=false, indent=1
|
195
|
+
#### uses_emerge? quiet=false, indent=1
|
196
|
+
#### is_executable? file, quiet=false, indent=1
|
197
|
+
#### file_exists? file, quiet=false, indent=1
|
198
|
+
#### dir_exists? dir, quiet=false, indent=1
|
199
|
+
#### autostart_service service, quiet=false, indent=1
|
200
|
+
#### restart_service service, quiet=false, indent=1
|
201
|
+
#### reload_service service, quiet=false, indent=1
|
202
|
+
#### user_exists? user, quiet=false, indent=1
|
203
|
+
#### create_user user, home=nil, shell=nil, quiet=false, indent=1
|
204
|
+
|
205
|
+
#### collect_facts quiet=false, indent=1
|
206
|
+
#### is_os? os_list, quiet=false, indent=1
|
207
|
+
#### is_debian? quiet=false, indent=1
|
208
|
+
#### is_ubuntu? quiet=false, indent=1
|
209
|
+
#### is_gentoo? quiet=false, indent=1
|
210
|
+
#### is_centos? quiet=false, indent=1
|
211
|
+
#### is_scientific? quiet=false, indent=1
|
212
|
+
#### is_fedora? quiet=false, indent=1
|
213
|
+
|
214
|
+
|
215
|
+
### example recipes
|
216
|
+
|
217
|
+
The best is to have a look at dusts build-in recipes: https://github.com/kechagia/dust-deploy/tree/master/lib/dust/recipes
|
218
|
+
|
219
|
+
this is the basic skeletton of a recipe file, placed in recipes/your_task.rb
|
220
|
+
|
221
|
+
class YourTask < Thor
|
222
|
+
desc 'your_task:deploy', 'example task: displays a message and does basically nothing'
|
223
|
+
def deploy node, ingredients, options
|
224
|
+
|
225
|
+
::Dust.print_msg 'this is a test example. welcome! output of uname -a below:'
|
226
|
+
puts node.exec('uname -a')[:stdout]
|
227
|
+
|
228
|
+
node.uses_apt?
|
229
|
+
|
230
|
+
node.restart_service 'your-service' if options.restart?
|
231
|
+
end
|
232
|
+
|
233
|
+
desc 'your_task:status', 'example status: displays the status of this recipe (optional)'
|
234
|
+
def status, node, ingredients, options
|
235
|
+
::Dust.print_msg "displaying status of this example recipe!"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
148
239
|
|
149
240
|
contributing
|
150
241
|
------------
|
151
242
|
|
152
243
|
you have a cool contribution or bugfix? yippie! just file in a pull-request!
|
153
244
|
|
154
|
-
### the server.rb methods you can (and should!) use
|
data/bin/dust
CHANGED
@@ -4,6 +4,7 @@ require 'rubygems'
|
|
4
4
|
require 'thor/runner'
|
5
5
|
require 'thor/util'
|
6
6
|
require 'yaml'
|
7
|
+
require 'fileutils'
|
7
8
|
require 'dust'
|
8
9
|
|
9
10
|
# stole this from rails
|
@@ -74,6 +75,24 @@ module Dust
|
|
74
75
|
end
|
75
76
|
|
76
77
|
|
78
|
+
# creates directory skeleton for a dust setup
|
79
|
+
desc 'newnetwork <name>', 'creates a dust directory skeleton for your network'
|
80
|
+
def newnetwork name
|
81
|
+
Dust.print_msg "spawning new dust directory skeleton into '#{name}.dust'"
|
82
|
+
Dir.mkdir "#{name}.dust"
|
83
|
+
Dir.mkdir "#{name}.dust/nodes"
|
84
|
+
Dir.mkdir "#{name}.dust/recipes"
|
85
|
+
Dir.mkdir "#{name}.dust/templates"
|
86
|
+
Dust.print_ok
|
87
|
+
|
88
|
+
Dust.print_msg "copying example yaml node configuration files\n"
|
89
|
+
Dir[File.dirname(__FILE__) + '/../lib/dust/examples/nodes/*.yaml'].each do |file|
|
90
|
+
Dust.print_msg "copying #{File.basename file}", 2
|
91
|
+
FileUtils.cp file, "#{name}.dust/nodes/#{File.basename file}"
|
92
|
+
Dust.print_ok
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
77
96
|
private
|
78
97
|
|
79
98
|
# run specified recipes in the given context
|
data/dust.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["kk@rndsec.net"]
|
10
10
|
s.homepage = ""
|
11
11
|
s.summary = %q{small server deployment tool for complex environments}
|
12
|
-
s.description = %q{when puppet and chef suck because you want to be in control and sprinkle just cannot
|
12
|
+
s.description = %q{when puppet and chef suck because you want to be in control and sprinkle just cannot do enough for you}
|
13
13
|
|
14
14
|
s.rubyforge_project = "dust-deploy"
|
15
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Newrelic < Thor
|
2
|
+
desc 'newrelic:deploy', 'installs and configures newrelic system monitoring'
|
3
|
+
def deploy node, key, options
|
4
|
+
return Dust.print_failed 'no key specified' unless key
|
5
|
+
return unless node.uses_apt?
|
6
|
+
|
7
|
+
::Dust.print_msg 'updating repositories'
|
8
|
+
::Dust.print_result node.exec('aptitude update')[:exit_code]
|
9
|
+
|
10
|
+
unless node.install_package 'newrelic-sysmond'
|
11
|
+
::Dust.print_failed 'installing newrelic monitoring daemon failed, did you setup the newrelic repositories?'
|
12
|
+
return
|
13
|
+
end
|
14
|
+
|
15
|
+
::Dust.print_msg 'configuring new relic server monitoring tool'
|
16
|
+
return unless ::Dust.print_result node.exec("nrsysmond-config --set ssl=true license_key=#{key}")[:exit_code]
|
17
|
+
|
18
|
+
node.restart_service 'newrelic-sysmond' if options.restart?
|
19
|
+
end
|
20
|
+
end
|
data/lib/dust/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- kris kechagia
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: "0"
|
66
66
|
type: :runtime
|
67
67
|
version_requirements: *id004
|
68
|
-
description: when puppet and chef suck because you want to be in control and sprinkle just cannot
|
68
|
+
description: when puppet and chef suck because you want to be in control and sprinkle just cannot do enough for you
|
69
69
|
email:
|
70
70
|
- kk@rndsec.net
|
71
71
|
executables:
|
@@ -83,6 +83,9 @@ files:
|
|
83
83
|
- dust.gemspec
|
84
84
|
- lib/dust.rb
|
85
85
|
- lib/dust/convert_size.rb
|
86
|
+
- lib/dust/examples/nodes/_debian.yaml
|
87
|
+
- lib/dust/examples/nodes/_default.yaml
|
88
|
+
- lib/dust/examples/nodes/example.yaml
|
86
89
|
- lib/dust/print_status.rb
|
87
90
|
- lib/dust/recipes/aliases.rb
|
88
91
|
- lib/dust/recipes/basic_setup.rb
|
@@ -94,6 +97,7 @@ files:
|
|
94
97
|
- lib/dust/recipes/memory_limit.rb
|
95
98
|
- lib/dust/recipes/motd.rb
|
96
99
|
- lib/dust/recipes/mysql.rb
|
100
|
+
- lib/dust/recipes/newrelic.rb
|
97
101
|
- lib/dust/recipes/nginx.rb
|
98
102
|
- lib/dust/recipes/packages.rb
|
99
103
|
- lib/dust/recipes/postgres.rb
|