dev-lxc 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +5 -2
- data/lib/dev-lxc/chef-cluster.rb +0 -4
- data/lib/dev-lxc/chef-server.rb +68 -27
- data/lib/dev-lxc/version.rb +1 -1
- data/lib/dev-lxc.rb +3 -1
- metadata +16 -29
- data/files/create_users/create_users.rb +0 -53
- data/files/create_users/default.rb +0 -261
- data/files/create_users/knife.rb.erb +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c4a6d760a6df8b811cd6028e91d1964e8396de53
|
4
|
+
data.tar.gz: 8aeba30eb10916eaf0e193addad0d1c6e126e28b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5848cd101928b5769f0f1f376fd5900d7644a4069e9591c06554b5fba411d0c6176df9fa68e349b134cbdb12131af09a1c63d18d132095df10fc29d646a1239d
|
7
|
+
data.tar.gz: ee0568a316d55e9e3694d087407fbceb6c3957883b0317a1cb6ea068c44f1bc09febee771bd017d65b4124f8b799e41f9c442d609af78d7f3e6080e945184475
|
data/README.md
CHANGED
@@ -297,8 +297,11 @@ creation of the cluster's servers is very quick.
|
|
297
297
|
|
298
298
|
[https://chef-tier.lxc](https://chef-tier.lxc) resolves to the frontend.
|
299
299
|
|
300
|
-
|
301
|
-
the bootstrap backend server in /
|
300
|
+
A test org and user and knife.rb and keys are automatically created in
|
301
|
+
the bootstrap backend server in /root/chef-repo/.chef for testing purposes.
|
302
|
+
The `knife-opc` plugin is installed in the embedded ruby environment of the
|
303
|
+
Private Chef and Enterprise Chef server to facilitate the creation of the test
|
304
|
+
org and user.
|
302
305
|
|
303
306
|
Show the status of the cluster.
|
304
307
|
|
data/lib/dev-lxc/chef-cluster.rb
CHANGED
@@ -83,10 +83,6 @@ module DevLXC
|
|
83
83
|
|
84
84
|
def chef_server_config
|
85
85
|
chef_server_config = %Q(api_fqdn "#{@api_fqdn}"\n)
|
86
|
-
@cluster_config["packages"]["server"].to_s.match(/(private-chef|chef-server)[_-](\d+)\.(\d+\.?){2,}-/)
|
87
|
-
if Regexp.last_match[2].to_i >= 11
|
88
|
-
chef_server_config += %Q(bookshelf["vip"] = "#{@api_fqdn}"\n)
|
89
|
-
end
|
90
86
|
if %w(tier ha).include?(@topology)
|
91
87
|
chef_server_config += %Q(
|
92
88
|
topology "#{@topology}"
|
data/lib/dev-lxc/chef-server.rb
CHANGED
@@ -28,9 +28,24 @@ module DevLXC
|
|
28
28
|
@base_platform = cluster_config["base_platform"]
|
29
29
|
@packages = cluster_config["packages"]
|
30
30
|
|
31
|
+
if File.basename(@packages["server"]).match(/^(\w+-\w+.*)[_-]((?:\d+\.?){3,})-/)
|
32
|
+
@chef_server_type = Regexp.last_match[1]
|
33
|
+
@chef_server_version = Regexp.last_match[2].gsub(".", "-")
|
34
|
+
end
|
35
|
+
|
31
36
|
@base_server_name = @base_platform
|
32
|
-
|
33
|
-
|
37
|
+
case @chef_server_type
|
38
|
+
when 'chef-server-core'
|
39
|
+
@base_server_name += '-cs'
|
40
|
+
@server_ctl = 'chef-server'
|
41
|
+
when 'private-chef'
|
42
|
+
@base_server_name += '-ec'
|
43
|
+
@server_ctl = 'private-chef'
|
44
|
+
when 'chef-server'
|
45
|
+
@base_server_name += '-osc'
|
46
|
+
@server_ctl = 'chef-server'
|
47
|
+
end
|
48
|
+
@base_server_name += "-#{@chef_server_version}"
|
34
49
|
@base_server_name += "-reporting-#{Regexp.last_match[1].gsub(".", "-")}" if @packages["reporting"].to_s.match(/[_-]((\d+\.?){3,})-/)
|
35
50
|
@base_server_name += "-pushy-#{Regexp.last_match[1].gsub(".", "-")}" if @packages["push-jobs-server"].to_s.match(/[_-]((\d+\.?){3,})-/)
|
36
51
|
end
|
@@ -181,19 +196,26 @@ module DevLXC
|
|
181
196
|
case @role
|
182
197
|
when "open-source"
|
183
198
|
puts "Creating /etc/chef-server/chef-server.rb"
|
184
|
-
FileUtils.
|
199
|
+
FileUtils.mkdir_p("#{@server.config_item('lxc.rootfs')}/etc/chef-server")
|
185
200
|
IO.write("#{@server.config_item('lxc.rootfs')}/etc/chef-server/chef-server.rb", @chef_server_config)
|
186
|
-
run_ctl(
|
201
|
+
run_ctl(@server_ctl, "reconfigure")
|
187
202
|
when "standalone", "bootstrap_backend"
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
203
|
+
case @chef_server_type
|
204
|
+
when 'private-chef'
|
205
|
+
puts "Creating /etc/opscode/private-chef.rb"
|
206
|
+
FileUtils.mkdir_p("#{@server.config_item('lxc.rootfs')}/etc/opscode")
|
207
|
+
IO.write("#{@server.config_item('lxc.rootfs')}/etc/opscode/private-chef.rb", @chef_server_config)
|
208
|
+
when 'chef-server-core'
|
209
|
+
puts "Creating /etc/opscode/chef-server.rb"
|
210
|
+
FileUtils.mkdir_p("#{@server.config_item('lxc.rootfs')}/etc/opscode")
|
211
|
+
IO.write("#{@server.config_item('lxc.rootfs')}/etc/opscode/chef-server.rb", @chef_server_config)
|
212
|
+
end
|
213
|
+
run_ctl(@server_ctl, "reconfigure")
|
192
214
|
when "secondary_backend", "frontend"
|
193
215
|
puts "Copying /etc/opscode from bootstrap backend"
|
194
216
|
FileUtils.cp_r("#{LXC::Container.new(@bootstrap_backend).config_item('lxc.rootfs')}/etc/opscode",
|
195
217
|
"#{@server.config_item('lxc.rootfs')}/etc")
|
196
|
-
run_ctl(
|
218
|
+
run_ctl(@server_ctl, "reconfigure")
|
197
219
|
end
|
198
220
|
end
|
199
221
|
|
@@ -203,23 +225,25 @@ module DevLXC
|
|
203
225
|
FileUtils.cp_r("#{LXC::Container.new(@bootstrap_backend).config_item('lxc.rootfs')}/etc/opscode-reporting",
|
204
226
|
"#{@server.config_item('lxc.rootfs')}/etc")
|
205
227
|
end
|
206
|
-
run_ctl(
|
228
|
+
run_ctl(@server_ctl, "reconfigure")
|
207
229
|
run_ctl("opscode-reporting", "reconfigure")
|
208
230
|
end
|
209
231
|
|
210
232
|
def configure_push_jobs_server
|
211
233
|
run_ctl("opscode-push-jobs-server", "reconfigure")
|
212
234
|
if %w(bootstrap_backend secondary_backend).include?(@role)
|
213
|
-
run_ctl(
|
235
|
+
run_ctl(@server_ctl, "reconfigure")
|
214
236
|
end
|
215
|
-
run_ctl(
|
237
|
+
run_ctl(@server_ctl, "restart opscode-pushy-server")
|
216
238
|
end
|
217
239
|
|
218
240
|
def configure_manage
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
241
|
+
if @chef_server_type == 'private-chef'
|
242
|
+
puts "Disabling old opscode-webui in /etc/opscode/private-chef.rb"
|
243
|
+
DevLXC.search_file_delete_line("#{@server.config_item('lxc.rootfs')}/etc/opscode/private-chef.rb", /opscode_webui[.enable.]/)
|
244
|
+
DevLXC.append_line_to_file("#{@server.config_item('lxc.rootfs')}/etc/opscode/private-chef.rb", "\nopscode_webui['enable'] = false\n")
|
245
|
+
run_ctl(@server_ctl, "reconfigure")
|
246
|
+
end
|
223
247
|
run_ctl("opscode-manage", "reconfigure")
|
224
248
|
end
|
225
249
|
|
@@ -229,17 +253,34 @@ module DevLXC
|
|
229
253
|
end
|
230
254
|
|
231
255
|
def create_users
|
232
|
-
puts "Creating
|
233
|
-
FileUtils.mkdir_p(
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
256
|
+
puts "Creating org, user, keys and knife.rb in /root/chef-repo/.chef"
|
257
|
+
FileUtils.mkdir_p("#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef")
|
258
|
+
knife_rb = "chef_server_url 'https://127.0.0.1/organizations/ponyville'\n"
|
259
|
+
knife_rb += "node_name 'rainbowdash'\n"
|
260
|
+
knife_rb += "client_key 'rainbowdash.pem'\n"
|
261
|
+
knife_rb += "knife[:chef_repo_path] = Dir.pwd\n"
|
262
|
+
IO.write("#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef/knife.rb", knife_rb)
|
263
|
+
case @chef_server_type
|
264
|
+
when 'private-chef'
|
265
|
+
# give time for all services to come up completely
|
266
|
+
sleep 60
|
267
|
+
pivotal_rb = "chef_server_root 'https://127.0.0.1/'\n"
|
268
|
+
pivotal_rb += "chef_server_url 'https://127.0.0.1/'\n"
|
269
|
+
pivotal_rb += "node_name 'pivotal'\n"
|
270
|
+
pivotal_rb += "client_key '/etc/opscode/pivotal.pem'\n"
|
271
|
+
pivotal_rb += "knife[:chef_repo_path] = Dir.pwd\n"
|
272
|
+
IO.write("#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef/pivotal.rb", pivotal_rb)
|
273
|
+
@server.run_command("/opt/opscode/embedded/bin/gem install knife-opc --no-ri --no-rdoc")
|
274
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc org create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem -c /root/chef-repo/.chef/pivotal.rb")
|
275
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc user create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem -c /root/chef-repo/.chef/pivotal.rb")
|
276
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc org user add ponyville rainbowdash --admin")
|
277
|
+
when 'chef-server-core'
|
278
|
+
# give time for all services to come up completely
|
279
|
+
sleep 10
|
280
|
+
run_ctl(@server_ctl, "org-create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem")
|
281
|
+
run_ctl(@server_ctl, "user-create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem")
|
282
|
+
run_ctl(@server_ctl, "org-user-add ponyville rainbowdash --admin")
|
283
|
+
end
|
243
284
|
end
|
244
285
|
end
|
245
286
|
end
|
data/lib/dev-lxc/version.rb
CHANGED
data/lib/dev-lxc.rb
CHANGED
@@ -18,6 +18,8 @@ module DevLXC
|
|
18
18
|
base_platform.create("download", "btrfs", 0, ["-d", "ubuntu", "-r", "lucid", "-a", "amd64"])
|
19
19
|
when "b-ubuntu-1204"
|
20
20
|
base_platform.create("download", "btrfs", 0, ["-d", "ubuntu", "-r", "precise", "-a", "amd64"])
|
21
|
+
when "b-ubuntu-1404"
|
22
|
+
base_platform.create("download", "btrfs", 0, ["-d", "ubuntu", "-r", "trusty", "-a", "amd64"])
|
21
23
|
when "b-centos-5"
|
22
24
|
base_platform.create("centos", "btrfs", 0, ["-R", "5"])
|
23
25
|
when "b-centos-6"
|
@@ -45,7 +47,7 @@ module DevLXC
|
|
45
47
|
end
|
46
48
|
base_platform.run_command("apt-get update")
|
47
49
|
base_platform.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox curl tree")
|
48
|
-
when "b-ubuntu-1204"
|
50
|
+
when "b-ubuntu-1204", "b-ubuntu-1404"
|
49
51
|
base_platform.run_command("apt-get update")
|
50
52
|
base_platform.run_command("apt-get install -y standard^ server^ vim-nox emacs23-nox tree")
|
51
53
|
when "b-centos-5"
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev-lxc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremiah Snapp
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: thor
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: ruby-lxc
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 1.0.1
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 1.0.1
|
78
69
|
description: A tool for creating Chef server clusters using LXC containers
|
@@ -83,7 +74,7 @@ executables:
|
|
83
74
|
extensions: []
|
84
75
|
extra_rdoc_files: []
|
85
76
|
files:
|
86
|
-
- .gitignore
|
77
|
+
- ".gitignore"
|
87
78
|
- Gemfile
|
88
79
|
- LICENSE
|
89
80
|
- README.md
|
@@ -94,9 +85,6 @@ files:
|
|
94
85
|
- files/configs/open-source.yaml
|
95
86
|
- files/configs/standalone.yaml
|
96
87
|
- files/configs/tier.yaml
|
97
|
-
- files/create_users/create_users.rb
|
98
|
-
- files/create_users/default.rb
|
99
|
-
- files/create_users/knife.rb.erb
|
100
88
|
- lib/dev-lxc.rb
|
101
89
|
- lib/dev-lxc/chef-cluster.rb
|
102
90
|
- lib/dev-lxc/chef-server.rb
|
@@ -106,27 +94,26 @@ files:
|
|
106
94
|
homepage: https://github.com/jeremiahsnapp/dev-lxc
|
107
95
|
licenses:
|
108
96
|
- Apache2
|
97
|
+
metadata: {}
|
109
98
|
post_install_message:
|
110
99
|
rdoc_options: []
|
111
100
|
require_paths:
|
112
101
|
- lib
|
113
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
103
|
requirements:
|
116
|
-
- -
|
104
|
+
- - ">="
|
117
105
|
- !ruby/object:Gem::Version
|
118
106
|
version: '0'
|
119
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
108
|
requirements:
|
122
|
-
- -
|
109
|
+
- - ">="
|
123
110
|
- !ruby/object:Gem::Version
|
124
111
|
version: '0'
|
125
112
|
requirements: []
|
126
113
|
rubyforge_project:
|
127
|
-
rubygems_version:
|
114
|
+
rubygems_version: 2.4.1
|
128
115
|
signing_key:
|
129
|
-
specification_version:
|
116
|
+
specification_version: 4
|
130
117
|
summary: A tool for creating Chef server clusters using LXC containers
|
131
118
|
test_files: []
|
132
119
|
has_rdoc:
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Authors
|
2
|
-
# Seth Chisamore
|
3
|
-
# Seth Falcon
|
4
|
-
# Jeremiah Snapp
|
5
|
-
|
6
|
-
require 'chef/mixin/shell_out'
|
7
|
-
include Chef::Mixin::ShellOut
|
8
|
-
|
9
|
-
class PiabHelper
|
10
|
-
|
11
|
-
VALID_OMNIBUS_ROOTS = %w{
|
12
|
-
/opt/opscode
|
13
|
-
/opt/chef-server
|
14
|
-
}
|
15
|
-
|
16
|
-
def self.omnibus_root
|
17
|
-
@@root_path ||= begin
|
18
|
-
root_path = VALID_OMNIBUS_ROOTS.detect{|path| File.exists?(path) }
|
19
|
-
raise "Could not locate one of #{VALID_OMNIBUS_ROOTS.join(', ')}" unless root_path
|
20
|
-
root_path
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.omnibus_bin_path
|
25
|
-
self.omnibus_root + "/embedded/bin"
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.private_chef_ha?
|
29
|
-
File.exists?("/etc/opscode/private-chef.rb") && File.read("/etc/opscode/private-chef.rb") =~ /topology\s+.*ha/
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.private_chef?
|
33
|
-
File.exists?("/opt/opscode/bin/private-chef-ctl")
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.open_source_chef?
|
37
|
-
File.exists?("/opt/chef-server/bin/chef-server-ctl")
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.existing_config
|
41
|
-
config_files = {
|
42
|
-
"private_chef" => "/etc/opscode/chef-server-running.json",
|
43
|
-
"chef_server" => "/etc/chef-server/chef-server-running.json"
|
44
|
-
}
|
45
|
-
config_files.each do |key, path|
|
46
|
-
if ::File.exists?(path)
|
47
|
-
return Chef::JSONCompat.from_json(IO.read(path))[key]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
raise "No existing config found"
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,261 +0,0 @@
|
|
1
|
-
# Authors
|
2
|
-
# Seth Chisamore
|
3
|
-
# Seth Falcon
|
4
|
-
|
5
|
-
# OPC config data
|
6
|
-
# TODO - read this in from /etc/opscode/chef-server-running.json
|
7
|
-
opc_bundle = "#{PiabHelper.omnibus_root}/embedded/bin/bundle"
|
8
|
-
opscode_account_url = "http://127.0.0.1:9465"
|
9
|
-
opscode_account_path = "#{PiabHelper.omnibus_root}/embedded/service/opscode-account"
|
10
|
-
superuser_pem = "/etc/opscode/pivotal.pem"
|
11
|
-
superuser_name = ::File.basename(superuser_pem).split('.')[0]
|
12
|
-
user_root = "/srv/piab/users"
|
13
|
-
dev_users = {}
|
14
|
-
|
15
|
-
organizations = {
|
16
|
-
'ponyville' => [
|
17
|
-
'rainbowdash',
|
18
|
-
'fluttershy',
|
19
|
-
'applejack',
|
20
|
-
'pinkiepie',
|
21
|
-
'twilightsparkle',
|
22
|
-
'rarity'
|
23
|
-
],
|
24
|
-
'wonderbolts' => [
|
25
|
-
'spitfire',
|
26
|
-
'soarin',
|
27
|
-
'rapidfire',
|
28
|
-
'fleetfoot'
|
29
|
-
]
|
30
|
-
}
|
31
|
-
|
32
|
-
organizations.each do |orgname, users|
|
33
|
-
|
34
|
-
users.each do |username|
|
35
|
-
|
36
|
-
folder = "#{user_root}/#{username}"
|
37
|
-
dot_chef = "#{folder}/.chef"
|
38
|
-
|
39
|
-
dev_users[username] = {
|
40
|
-
'username' => username,
|
41
|
-
'displayname' => username,
|
42
|
-
'email' => "#{username}@mylittlepony.com",
|
43
|
-
'orgname' => orgname,
|
44
|
-
'folder' => folder,
|
45
|
-
'private_key' => "#{dot_chef}/#{username}.pem",
|
46
|
-
'org_validator' => "#{dot_chef}/#{username}-validator.pem",
|
47
|
-
'knife_config' => "#{dot_chef}/knife.rb"
|
48
|
-
}
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
unless File.exists?("/srv/piab/dev_users_created")
|
54
|
-
|
55
|
-
ruby_block "Waiting for first-time OPC initializtion" do
|
56
|
-
block do
|
57
|
-
sleep 10
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
dev_users.each_pair do |name, options|
|
62
|
-
|
63
|
-
# create the students .chef/ dir
|
64
|
-
directory ::File.dirname(options['private_key']) do
|
65
|
-
recursive true
|
66
|
-
action :create
|
67
|
-
end
|
68
|
-
|
69
|
-
# create an account on the OPC for the student
|
70
|
-
execute "create OPC account #{name}" do
|
71
|
-
command <<-EOH
|
72
|
-
#{opc_bundle} exec bin/createobjecttool --object-type 'user' -a '#{opscode_account_url}' \
|
73
|
-
--object-name #{options['username']} --displayname '#{options['displayname']}' -e '#{options['email']}' \
|
74
|
-
-f '#{options['displayname']}' -m '#{options['displayname']}' -l '#{options['displayname']}' \
|
75
|
-
--key-path #{options['private_key']} --user-password '#{options['username']}' \
|
76
|
-
--opscode-username #{superuser_name} --opscode-private-key #{superuser_pem}
|
77
|
-
EOH
|
78
|
-
cwd opscode_account_path
|
79
|
-
end
|
80
|
-
|
81
|
-
# create a knife.rb file for the user
|
82
|
-
template "#{options['knife_config']}" do
|
83
|
-
source "knife.rb.erb"
|
84
|
-
variables(
|
85
|
-
:username => options['username'],
|
86
|
-
:orgname => options['orgname'],
|
87
|
-
:server_fqdn => 'chef.lxc'
|
88
|
-
)
|
89
|
-
mode "0777"
|
90
|
-
action :create
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
# create the orgs and associate the users
|
96
|
-
organizations.each do |orgname, users|
|
97
|
-
|
98
|
-
org_validator = "#{user_root}/#{orgname}-validator.pem"
|
99
|
-
|
100
|
-
ruby_block "create OPC organization #{orgname}" do
|
101
|
-
block do
|
102
|
-
cmd =<<-EOH
|
103
|
-
#{opc_bundle} exec bin/createorgtool -t Business -a '#{opscode_account_url}' \
|
104
|
-
--org-name #{orgname} --customer-org-fullname '#{orgname}' \
|
105
|
-
--username '#{users.join(' ')}' \
|
106
|
-
--client-key-path #{org_validator} \
|
107
|
-
--opscode-username #{superuser_name} --opscode-private-key #{superuser_pem}
|
108
|
-
EOH
|
109
|
-
waiting = true
|
110
|
-
while waiting
|
111
|
-
opts = {:cwd => opscode_account_path,
|
112
|
-
:returns => [0,53]}
|
113
|
-
case shell_out(cmd, opts).exitstatus
|
114
|
-
when 53
|
115
|
-
Chef::Log.info("...")
|
116
|
-
sleep 10
|
117
|
-
when 0
|
118
|
-
Chef::Log.info("#{orgname} created!")
|
119
|
-
waiting = false
|
120
|
-
else
|
121
|
-
Chef::Log.error("#{orgname} not created...error!")
|
122
|
-
waiting = false
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
ruby_block 'LOL' do
|
131
|
-
block do
|
132
|
-
Chef::Log.info <<-EOH
|
133
|
-
|
134
|
-
|
135
|
-
.`
|
136
|
-
`,,,,,.` ;,;
|
137
|
-
,;;;;;''''';;;,:..; ` ;;
|
138
|
-
.;;;'''''''''''''';,...; ;;; ;,;
|
139
|
-
` ,;;;''''''''''''';;;;;,....; ;:,; ;..;
|
140
|
-
;;''''''';'''''';;;;;;;:,....,; ;,,,; ;:,,..;
|
141
|
-
:;;;;'';''''';;;;;;;;;,,.....:. `;,,,: ;,,:..,,
|
142
|
-
```;'''';;;;;;;;;;..,...;..; ;,,,: :,,;..,:`
|
143
|
-
;''';;;;;;;;;;;.,,:....:.,: ;,,,; :,,:...; :;;;
|
144
|
-
;''';;;;;;;;;;:,,,,;....;..;;` .,,,,: :,,;....; .:...;
|
145
|
-
,;';;;;;;;;;;;,,,,.;,....,,.,:;. ;,,,,. ;,,;...,: ;....;
|
146
|
-
`;';;;;;;;;;;;,,,,,,;......:..';;. ;,,,: `,,,:...:` .;....,,
|
147
|
-
;';;;;;;;;;;;,,,,,,,,.....:;.,;;;; ;,,,: ;,,:,...; ;;.....;
|
148
|
-
,;;;;;;;;;;;;;,,,:,,'......,,..;;;'; ;,,,; ;,,:....;.::....:
|
149
|
-
;;;;;;;;;;;;;.,,,'.:...........;;;;; ;,,,; ;,,;....;;'....,:
|
150
|
-
,;;;;;;;;;;;;,,,,,:,:...........:;;;;. ;,,,: ;,,'....',,....;
|
151
|
-
;;;;;;;;;;;;;,,,,;,;............,:;;'; ;,,,:,:,,;....';....,.
|
152
|
-
`:;;;;;;;;;;;.,,,';;.........,....';;;; ;,,,,;:,,:,...;:....;
|
153
|
-
;;;;;;;;;;;;;,,,;.;...........,...;;;;; ;,,,,;:,,:....;....,`
|
154
|
-
;;;;;;;;;;;;,,,;,,.+......;,':.;..:';;; ;,,,,;,,:,....:....;
|
155
|
-
.;;;;;;:;;@;#,,'...;......@@@@:@,..,;;;; :,,,,::,;.........,,
|
156
|
-
;;;;;;;;;;+;;,;....,...,,@@@@@@.@..,;;;; .:,,,,;,'.........; .;
|
157
|
-
:;;;::;;;';@#;.........'# +@@@@;...,;;;;, ;,,,,,,;........,; ,;;;: ;;;
|
158
|
-
;;;;; ;;;;;#;,'...,@...@;` `\#@@@....,;;;'; ;,,,:;,;..;;....;` ;,...,: .;;; .:;;;;;;;;;;,
|
159
|
-
`:;;. :;;;+';,: ,..,;@@+ : `\#@@@....:;;;;;` ;,,:,,::.'..,...;;,......:;;;; .;;'''''''''''''';;`
|
160
|
-
;:: ;;;;;.@@: @....;; ;. ;@@@#....;;;;;;; ;,:,,,;,'..,,..::........;'';,;;'''''''''';;:::,,,,,
|
161
|
-
.: ,;;;` + ;' @....,,` :;+@@@@'..,:;;;;;;;.,,,,,,;:...,...'........;'';;'''''''''''';,
|
162
|
-
;:: :'#:.....; `;;\#.\#@:..,;;;;;;;;;`:,,,,;:...;...........;;';;''''''';;;;'''';:
|
163
|
-
;: + @'.....@ ';;:;;;.,;;;;;;;;;;;:,,,,;...,:,........,;;'';''';;;;;;;;;;;;''';
|
164
|
-
: `;@+,.....@ ';,...,;;;;;;';;;;;:,,,:,...;,:,......:;''';;;;;;;;;;;;;;;;;;''';
|
165
|
-
` '::.......',..,...;;;;;;;;;;;;;,,,,;...;,...:,..,;;'''';;;;;;;;;;;;;;;;;;;''';
|
166
|
-
'........,:,,...;;';;;;;;;;;';:,,,,..;....,,.,;,,;;'';;;;;;;;;;;;;;;;;;;;;''';
|
167
|
-
;,.........,....:;;:;;;;;;;;;';:,,;..:.....;.,::,..,:;;;;;;;;;;;;;;;;;;;;;;;''';
|
168
|
-
.,.,..,..........;,;;;;;;;;;;''';,'........'..........;;;;;;;;;;;;;;;;;;';;;;'''';
|
169
|
-
;....;.........,,:;;;;;;;;;'''';;........;,,,,......:';;;;;::::;;';;;;;;';;;;'''':
|
170
|
-
;;;;..........;,:;;;;;;;;;'''';,......,;,...,,....;,.,,,,,,,,,,,,,;';;;;;;;;;''';`
|
171
|
-
`;,........,;;..;;;;;;;;;'''';.......,:.....;...,;;;;;::,,,..,,,,,,.;;;;;;;;;;''';
|
172
|
-
.;;;;;;;;. :,:;;;;;;;;'';'';.......,,....,,.,;:;;;;;;;;;;;;;:.,,,,,,;;;;;;;;''';`
|
173
|
-
;..;;;;;;;;;;;'';..............;:;;;'''''''''''';;;;;.,,,,:;;;;;;;;''';
|
174
|
-
;,:;;;;;;;;;;'';............,:;;..;';;:::;;''''''';;;;,,,,.';;;;;;;''';
|
175
|
-
:,.;;;;;;;;;;'';.........,,:;:,....,; :;''''''';;;:,,,;;;;;;;;;'';
|
176
|
-
;.:;;;;;;;::'';....;.,.....,,,......:, `;''';''';;;,,,:;;;;;;;;'';
|
177
|
-
`:.;;;;;;;.:';;......;:.....,:, :...; :''';:''';;;.,,;;;;;;;;;';
|
178
|
-
:.:;;;;:.,,;;,.........,:;;:,, ...,` ;''; ;'';;;:,.;;;;;;;;;';
|
179
|
-
;.;;;:...,;;...............` , .....; ;''; :''';;;,.';;;;;;;;';
|
180
|
-
;;;;....,;;..............,, , `.:...; .''; ;'';;;.,';;;;;,;;';
|
181
|
-
`;;,.....;,................, ` ..,:` .''; ;'';;;.,;;;;;;; ;;;
|
182
|
-
.;..........................,:` , ....:` :''; :'';;;.,:;;;;;; `;;
|
183
|
-
,............................,',,;.,....,` ;'; ;'';;;.,:;;;;;; ;;
|
184
|
-
,............................,'.,:,;....:` .;;: ;'';;;.,:;;;;;: `;
|
185
|
-
,............................,',,,,:...,; ;;, .''';;;,,:;;;;;. ;
|
186
|
-
.,....................,;,.....';'',:....; ;;. ;''';;;,,:;;;;;` ;
|
187
|
-
:......................;.....;'::,,...,: .; ;'';;;;,,,;;;;;, ,
|
188
|
-
:;;. ;......................::....,:.,,,..,:` ;'';;;;,,,;;;;;;
|
189
|
-
;,,;;;:::;;,;.,....................;,......,,,...; ;'';;;;,,,;;;;;;
|
190
|
-
;,,,,,,,,,,,:,:,....................;,.....,:,....;` .''';;;;.,,;;;;;;
|
191
|
-
`:,,,,,,,,,,,,;:......,............,;:;......:......;;. ,''';;;;.,,;;;;;;
|
192
|
-
:,,,,,,,,,,,,,,;......'.........,;; ;,:;,....,........:;;:` :''';;;;.,,;;;;;;
|
193
|
-
;,,,,,,,,,,,,,,;......;,....,,;;, ;,,;;,..............,;, ;''';;;;,,,;;;;;:
|
194
|
-
;,,,,,,,,,,,,,,:.....,:,::::,` ;,,,:;,..............;` ;''';;;:,,,;;;;;.
|
195
|
-
.:,,,,,:,:;;;;;;,......,` ;:,,,:;;,...........,; ;''';;::,,:;;;;;
|
196
|
-
;,,,,,,::` ;.......,, ,;,,,,,;;,..........:; ;''';;;,,,:;;;;;
|
197
|
-
;,,,,,,:` ;.......,: ;:,,,,,;;,.........; ;''';;:.,,;;;;;,
|
198
|
-
;,,,,,,,: :........: .;,,,,,,;.........,; ;''';;;.,,;;;;;
|
199
|
-
,:,,,,,,,; ,,........; ::,,,,,,;.........; ;'''':;.,,';;;;
|
200
|
-
;,,,,,,,,:` ;.........; ;,,,,,,:,........:;,;''':;.,,';;;:
|
201
|
-
;,,,,,,,,,; ;.........: ;,,,,,,,;.........; ;''';;.,,';;;,
|
202
|
-
;,,,,,,,,,;` ,.........: ;,,,,,,,:;........;.,'''';,,,';;;.
|
203
|
-
;,,,,,,,,,,; ..........,, :,,,,,,,,;........,; ;'''.;,,;;;;,
|
204
|
-
;,,,,,,,,,,;, ;.........,. :,,,,,,,,;.........;` ;'';`;,,;;;:
|
205
|
-
`:,,,,,,,,,,,; :.........,` :,,,,,,,,;,........:; ,;'; ,:.'';;
|
206
|
-
`:,,,,,,,,,,,;;,.........: ;,,,,,,,,::.........; :;; ::';;;
|
207
|
-
`:,,,,,,,,,,,,;.........,; ;,,,,,,,,:;,........;: :': ::;;;`
|
208
|
-
:,,,,,,,,,,,,:,.........; ;,,,,,,,,:;.........,; :; ,;;;;
|
209
|
-
;,,,,,,,,,,,;...........; `:,,,,,,,,:;..........;. ,; ,;;;
|
210
|
-
;,,,,,,,,,,,:,..........; :,,,,,,,,,;;..........:; ,: ,;;;
|
211
|
-
:,,,,,,,,,,;...........,. ;,,,,,,,,,;;..........,; `: ,;;
|
212
|
-
;,,,,,,,,,,...........:` ;,,,,,,,,,;;...........; :;,
|
213
|
-
;,,,,,,,,;............; .;,,,,,,,,,;;...........;. ;:
|
214
|
-
`:,,,,,,:.............; ;,,,,,,,,,,:;..........,:: .,
|
215
|
-
;,,,,,;:............,: ;,,,,,,,,,,,;...........:: `
|
216
|
-
;,,;;:.............:` ;,,,,,,,,,,`;...........,;
|
217
|
-
:, :.............; ,,,,,,,,,,,: ;,..........,;
|
218
|
-
;..............; ;,,,,,,,,,,:,:............;
|
219
|
-
.:.............,` `;,,,,,,,,,,;;,............;`
|
220
|
-
;..............; ;,,,,,,,,,,,.;............,:`
|
221
|
-
:,.............., `;,,,,:::::;;`;........,...:;
|
222
|
-
:..............: ,,,,,..`` :...,,,::;;;;.
|
223
|
-
;;;::::::::::;;;; ,;;:`
|
224
|
-
|
225
|
-
. t#, L. .,
|
226
|
-
;W ;##W. EW: ,ft t ,Wt
|
227
|
-
f#E :#L:WE E##; t#E Ej i#D.
|
228
|
-
.E#f .KG ,#D E###t t#E E#, f#f
|
229
|
-
iWW; EE ;#f E#fE#f t#E E#t .D#i
|
230
|
-
L##Lffi f#. t#i E#t D#G t#E E#t :KW, .......
|
231
|
-
tLLG##L :#G GK E#t f#E. t#E E#t t#f GEEEEEEf.
|
232
|
-
,W#i ;#L LW. E#t t#K: t#E E#t ;#G
|
233
|
-
j#E. t#f f#: E#t ;#W,t#E E#t :KE.
|
234
|
-
.D#j f#D#; E#t :K#D#E E#t .DW:
|
235
|
-
,WK, G#t E#t .E##E E#t L#,
|
236
|
-
EG. t .. G#E E#t jt
|
237
|
-
, fE ,;.
|
238
|
-
,
|
239
|
-
L. t#, t#,
|
240
|
-
j. t EW: ,ft . ;##W. ;##W.
|
241
|
-
EW, .. Ej E##; t#E Ef. :#L:WE :#L:WE .. :
|
242
|
-
E##j ;W, E#, E###t t#E E#Wi .KG ,#D .KG ,#D ,W, .Et
|
243
|
-
E###D. j##, E#t E#fE#f t#E E#K#D: EE ;#f EE ;#f t##, ,W#t
|
244
|
-
E#jG#W; G###, E#t E#t D#G t#E E#t,E#f. f#. t#i f#. t#i L###, j###t
|
245
|
-
E#t t##f :E####, E#t E#t f#E. t#E E#WEE##Wt:#G GK :#G GK .E#j##, G#fE#t
|
246
|
-
E#t :K#E: ;W#DG##, E#t E#t t#K: t#E E##Ei;;;;.;#L LW. ;#L LW. ;WW; ##,:K#i E#t
|
247
|
-
E#KDDDD###i j###DW##, E#t E#t ;#W,t#E E#DWWt t#f f#: t#f f#: j#E. ##f#W, E#t
|
248
|
-
E#f,t#Wi,,, G##i,,G##, E#t E#t :K#D#E E#t f#K; f#D#; f#D#; .D#L ###K: E#t
|
249
|
-
E#t ;#W: :K#K: L##, E#t E#t .E##E E#Dfff##E, G#t G#t :K#t ##D. E#t
|
250
|
-
DWi ,KK: ;##D. L##, E#t .. G#E jLLLLLLLLL; t t ... #G ..
|
251
|
-
,,, .,, ,;. fE j
|
252
|
-
,
|
253
|
-
EOH
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
file "/srv/piab/dev_users_created" do
|
258
|
-
content "Canned dev users and organization created successfully at #{Time.now}"
|
259
|
-
action :create
|
260
|
-
end
|
261
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Authors
|
2
|
-
# Seth Chisamore
|
3
|
-
# Mark Mzyk
|
4
|
-
|
5
|
-
current_dir = File.dirname(__FILE__)
|
6
|
-
log_level :info
|
7
|
-
log_location STDOUT
|
8
|
-
node_name "<%= @username %>"
|
9
|
-
client_key "#{current_dir}/<%= @username %>.pem"
|
10
|
-
validation_client_name "<%= @orgname %>-validator"
|
11
|
-
validation_key "#{current_dir}/../../<%= @orgname %>-validator.pem"
|
12
|
-
chef_server_url "https://<%= @server_fqdn %>/organizations/<%= @orgname %>"
|
13
|
-
cache_type 'BasicFile'
|
14
|
-
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
|
15
|
-
cookbook_path ["#{current_dir}/../cookbooks"]
|