ironfan 4.4.3 → 4.5.0

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v4.5.0: upgraded to 12.04 bootstrap
2
+ * First stab at 12.04 from @nickmarden's pull #171 - uses omnibus, not autobuild ruby
3
+ * Removed bad 11.10 bootstrap script - used incompatible ruby install
4
+ * Cleanup knife cluster proxy (may help #162)
5
+ * Added ec2 hints for ohai (fixes #204)
6
+ * chef-client runs once on boot only
7
+
1
8
  # v4.4.3:
2
9
  * workaround to make ec2 regions respect the cluster's region/AZ preference
3
10
  * Making validation scope name prefix properly (fixes #201)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.4.3
1
+ 4.5.0
File without changes
@@ -0,0 +1,148 @@
1
+ bash <<'EOF' || echo "Chef bootstrap failed!"
2
+
3
+ # This is the ubuntu precise bootstrap script from infochimps' ironfan. It is
4
+ # based on the opscode bootstrap script, with the important differences being it:
5
+ #
6
+ # * installs the Opscode-provided Chef client (including a self-contained Ruby 1.9.x) in /opt/chef
7
+ # * installs certain universally-useful gems into the Chef-provided Ruby gem set
8
+ # * pushes the node identity into the first-boot.json
9
+ # * installs the chef-client service and kicks off the first run of chef
10
+
11
+ <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
12
+
13
+ set -e
14
+
15
+ <%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
16
+
17
+ date > /etc/box_build_time
18
+
19
+ echo -e "`date` \n\n**** \n**** apt update:\n****\n"
20
+ apt-get --force-yes -y update
21
+ apt-get --force-yes -y upgrade
22
+
23
+ echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
24
+ apt-get --force-yes -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
25
+ apt-get clean
26
+
27
+ # do not trust the ubuntu chef package
28
+ rm -f /etc/init.d/chef-client || true
29
+ apt-get remove -y --force-yes chef ruby1.8-dev libjson-ruby1.8 libmixlib-authentication-ruby1.8 ohai libmixlib-log-ruby1.8 libmime-types-ruby librestclient-ruby1.8 ruby1.8 ruby liberubis-ruby1.8 libsystemu-ruby1.8 libohai-ruby libuuidtools-ruby1.8 libhighline-ruby1.8 libabstract-ruby1.8 libmixlib-config-ruby1.8 rubygems1.8 libbunny-ruby1.8 libchef-ruby1.8 libmixlib-cli-ruby1.8 libyajl-ruby libmoneta-ruby1.8 libohai-ruby1.8 libextlib-ruby1.8 || true
30
+ sudo apt-get autoremove -y --force-yes || true
31
+
32
+ mkdir -p /tmp/knife-bootstrap
33
+ chmod 700 /tmp/knife-bootstrap
34
+ cd /tmp/knife-bootstrap
35
+
36
+ eval `cat /etc/lsb-release `
37
+ export DEBIAN_FRONTEND=noninteractive
38
+
39
+ # Install a self-contained Chef client because Ubuntu ships with Ruby 1.8.x,
40
+ # which is not compatible with Ironfan
41
+ echo 'gem: --no-ri --no-rdoc' > /home/ubuntu/.gemrc
42
+ echo 'gem: --no-ri --no-rdoc' > /root/.gemrc
43
+ if [ ! -f /opt/chef/bin/chef-client ]; then
44
+ curl -L http://www.opscode.com/chef/install.sh | sudo bash
45
+ fi
46
+
47
+ # Set up the system to use the installed ruby and gem
48
+ ln -nfs /opt/chef/embedded/bin/ruby /usr/bin/ruby
49
+ ln -nfs /opt/chef/embedded/bin/gem /usr/bin/gem
50
+
51
+ gem install extlib bundler json right_aws pry fog
52
+
53
+ echo -e "`date` \n\n**** \n**** Knifing in the chef client config files:\n****\n"
54
+ mkdir -p /etc/chef
55
+
56
+ <%- if @config[:client_key] %>
57
+ (
58
+ cat <<'EOP'
59
+ <%= @config[:client_key] %>
60
+ EOP
61
+ ) > /tmp/knife-bootstrap/client.pem
62
+ awk NF /tmp/knife-bootstrap/client.pem > /etc/chef/client.pem
63
+ <%- else %>
64
+ (
65
+ cat <<'EOP'
66
+ <%= validation_key %>
67
+ EOP
68
+ ) > /tmp/knife-bootstrap/validation.pem
69
+ awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
70
+ <%- end %>
71
+
72
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
73
+ (
74
+ cat <<'EOP'
75
+ <%= encrypted_data_bag_secret %>
76
+ EOP
77
+ ) > /tmp/encrypted_data_bag_secret
78
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
79
+ rm /tmp/encrypted_data_bag_secret
80
+ <% end -%>
81
+
82
+ (
83
+ cat <<'EOP'
84
+ <%= config_content %>
85
+ <%= @config[:computer].chef_client_script_content %>
86
+ EOP
87
+ ) > /etc/chef/client.rb
88
+
89
+ (
90
+ cat <<'EOP'
91
+ <%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
92
+ EOP
93
+ ) > /etc/chef/first-boot.json
94
+
95
+ # Ensure that EC2 images are recognized even inside VPC
96
+ mkdir -p /etc/chef/ohai/hints/
97
+ touch /etc/chef/ohai/hints/ec2.json
98
+
99
+
100
+ echo -e "`date` \n\n**** \n**** Adding chef client nonce script:\n****\n"
101
+
102
+ cat > /etc/init.d/chef-client-nonce <<'EOP'
103
+ #! /bin/sh
104
+ ### BEGIN INIT INFO
105
+ # Provides: chef-client-nonce
106
+ # Required-Start: $remote_fs $network
107
+ # Required-Stop:
108
+ # Default-Start: 2 3 4 5
109
+ # Default-Stop: 0 1 6
110
+ # Short-Description: Start a single chef-client run.
111
+ ### END INIT INFO
112
+ #
113
+ # Copyright (c) 2009-2010 Opscode, Inc, <legal@opscode.com>
114
+ #
115
+ # chef-client Startup script for chef-client.
116
+ # chkconfig: - 99 02
117
+ # description: starts up chef-client once, at boot
118
+
119
+ case "$1" in
120
+ start)
121
+ /usr/bin/chef-client -L /var/log/chef/client.log
122
+ exit $?
123
+ ;;
124
+ *)
125
+ echo "Usage: /etc/init.d/chef-client-nonce start" >&2
126
+ exit 1
127
+ ;;
128
+ esac
129
+ EOP
130
+
131
+ mkdir -p /var/log/chef
132
+ chmod +x /etc/init.d/chef-client-nonce
133
+ update-rc.d chef-client-nonce defaults
134
+
135
+ <%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
136
+ sudo service chef-client-nonce start
137
+ <%- end %>
138
+
139
+
140
+
141
+ echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
142
+ cd /
143
+ rm -r /tmp/knife-bootstrap
144
+ # make locate work good
145
+ updatedb
146
+
147
+ echo -e "`date` \n\n**** \n**** Cluster Chef client bootstrap complete\n****\n"
148
+ EOF
data/ironfan.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ironfan"
8
- s.version = "4.4.3"
8
+ s.version = "4.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Infochimps"]
12
- s.date = "2012-10-31"
12
+ s.date = "2012-11-07"
13
13
  s.description = "Ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
14
14
  s.email = "coders@infochimps.com"
15
15
  s.extra_rdoc_files = [
@@ -35,11 +35,11 @@ Gem::Specification.new do |s|
35
35
  "config/knife.bash.README.md",
36
36
  "config/proxy.pac",
37
37
  "config/ubuntu10.04-ironfan.erb",
38
- "config/ubuntu11.10-ironfan.erb",
38
+ "config/ubuntu12.04-ironfan.erb",
39
39
  "ironfan.gemspec",
40
40
  "lib/chef/knife/bootstrap/centos6.2-ironfan.erb",
41
41
  "lib/chef/knife/bootstrap/ubuntu10.04-ironfan.erb",
42
- "lib/chef/knife/bootstrap/ubuntu11.10-ironfan.erb",
42
+ "lib/chef/knife/bootstrap/ubuntu12.04-ironfan.erb",
43
43
  "lib/chef/knife/cluster_bootstrap.rb",
44
44
  "lib/chef/knife/cluster_kick.rb",
45
45
  "lib/chef/knife/cluster_kill.rb",
File without changes
@@ -0,0 +1,148 @@
1
+ bash <<'EOF' || echo "Chef bootstrap failed!"
2
+
3
+ # This is the ubuntu precise bootstrap script from infochimps' ironfan. It is
4
+ # based on the opscode bootstrap script, with the important differences being it:
5
+ #
6
+ # * installs the Opscode-provided Chef client (including a self-contained Ruby 1.9.x) in /opt/chef
7
+ # * installs certain universally-useful gems into the Chef-provided Ruby gem set
8
+ # * pushes the node identity into the first-boot.json
9
+ # * installs the chef-client service and kicks off the first run of chef
10
+
11
+ <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
12
+
13
+ set -e
14
+
15
+ <%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
16
+
17
+ date > /etc/box_build_time
18
+
19
+ echo -e "`date` \n\n**** \n**** apt update:\n****\n"
20
+ apt-get --force-yes -y update
21
+ apt-get --force-yes -y upgrade
22
+
23
+ echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
24
+ apt-get --force-yes -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
25
+ apt-get clean
26
+
27
+ # do not trust the ubuntu chef package
28
+ rm -f /etc/init.d/chef-client || true
29
+ apt-get remove -y --force-yes chef ruby1.8-dev libjson-ruby1.8 libmixlib-authentication-ruby1.8 ohai libmixlib-log-ruby1.8 libmime-types-ruby librestclient-ruby1.8 ruby1.8 ruby liberubis-ruby1.8 libsystemu-ruby1.8 libohai-ruby libuuidtools-ruby1.8 libhighline-ruby1.8 libabstract-ruby1.8 libmixlib-config-ruby1.8 rubygems1.8 libbunny-ruby1.8 libchef-ruby1.8 libmixlib-cli-ruby1.8 libyajl-ruby libmoneta-ruby1.8 libohai-ruby1.8 libextlib-ruby1.8 || true
30
+ sudo apt-get autoremove -y --force-yes || true
31
+
32
+ mkdir -p /tmp/knife-bootstrap
33
+ chmod 700 /tmp/knife-bootstrap
34
+ cd /tmp/knife-bootstrap
35
+
36
+ eval `cat /etc/lsb-release `
37
+ export DEBIAN_FRONTEND=noninteractive
38
+
39
+ # Install a self-contained Chef client because Ubuntu ships with Ruby 1.8.x,
40
+ # which is not compatible with Ironfan
41
+ echo 'gem: --no-ri --no-rdoc' > /home/ubuntu/.gemrc
42
+ echo 'gem: --no-ri --no-rdoc' > /root/.gemrc
43
+ if [ ! -f /opt/chef/bin/chef-client ]; then
44
+ curl -L http://www.opscode.com/chef/install.sh | sudo bash
45
+ fi
46
+
47
+ # Set up the system to use the installed ruby and gem
48
+ ln -nfs /opt/chef/embedded/bin/ruby /usr/bin/ruby
49
+ ln -nfs /opt/chef/embedded/bin/gem /usr/bin/gem
50
+
51
+ gem install extlib bundler json right_aws pry fog
52
+
53
+ echo -e "`date` \n\n**** \n**** Knifing in the chef client config files:\n****\n"
54
+ mkdir -p /etc/chef
55
+
56
+ <%- if @config[:client_key] %>
57
+ (
58
+ cat <<'EOP'
59
+ <%= @config[:client_key] %>
60
+ EOP
61
+ ) > /tmp/knife-bootstrap/client.pem
62
+ awk NF /tmp/knife-bootstrap/client.pem > /etc/chef/client.pem
63
+ <%- else %>
64
+ (
65
+ cat <<'EOP'
66
+ <%= validation_key %>
67
+ EOP
68
+ ) > /tmp/knife-bootstrap/validation.pem
69
+ awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
70
+ <%- end %>
71
+
72
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
73
+ (
74
+ cat <<'EOP'
75
+ <%= encrypted_data_bag_secret %>
76
+ EOP
77
+ ) > /tmp/encrypted_data_bag_secret
78
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
79
+ rm /tmp/encrypted_data_bag_secret
80
+ <% end -%>
81
+
82
+ (
83
+ cat <<'EOP'
84
+ <%= config_content %>
85
+ <%= @config[:computer].chef_client_script_content %>
86
+ EOP
87
+ ) > /etc/chef/client.rb
88
+
89
+ (
90
+ cat <<'EOP'
91
+ <%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
92
+ EOP
93
+ ) > /etc/chef/first-boot.json
94
+
95
+ # Ensure that EC2 images are recognized even inside VPC
96
+ mkdir -p /etc/chef/ohai/hints/
97
+ touch /etc/chef/ohai/hints/ec2.json
98
+
99
+
100
+ echo -e "`date` \n\n**** \n**** Adding chef client nonce script:\n****\n"
101
+
102
+ cat > /etc/init.d/chef-client-nonce <<'EOP'
103
+ #! /bin/sh
104
+ ### BEGIN INIT INFO
105
+ # Provides: chef-client-nonce
106
+ # Required-Start: $remote_fs $network
107
+ # Required-Stop:
108
+ # Default-Start: 2 3 4 5
109
+ # Default-Stop: 0 1 6
110
+ # Short-Description: Start a single chef-client run.
111
+ ### END INIT INFO
112
+ #
113
+ # Copyright (c) 2009-2010 Opscode, Inc, <legal@opscode.com>
114
+ #
115
+ # chef-client Startup script for chef-client.
116
+ # chkconfig: - 99 02
117
+ # description: starts up chef-client once, at boot
118
+
119
+ case "$1" in
120
+ start)
121
+ /usr/bin/chef-client -L /var/log/chef/client.log
122
+ exit $?
123
+ ;;
124
+ *)
125
+ echo "Usage: /etc/init.d/chef-client-nonce start" >&2
126
+ exit 1
127
+ ;;
128
+ esac
129
+ EOP
130
+
131
+ mkdir -p /var/log/chef
132
+ chmod +x /etc/init.d/chef-client-nonce
133
+ update-rc.d chef-client-nonce defaults
134
+
135
+ <%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
136
+ sudo service chef-client-nonce start
137
+ <%- end %>
138
+
139
+
140
+
141
+ echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
142
+ cd /
143
+ rm -r /tmp/knife-bootstrap
144
+ # make locate work good
145
+ updatedb
146
+
147
+ echo -e "`date` \n\n**** \n**** Cluster Chef client bootstrap complete\n****\n"
148
+ EOF
@@ -62,10 +62,10 @@ class Chef
62
62
  def command_for_target(svr)
63
63
  config[:attribute] ||= Chef::Config[:knife][:ssh_address_attribute] || "fqdn"
64
64
  config[:ssh_user] ||= Chef::Config[:knife][:ssh_user]
65
- config[:identity_file] ||= svr.server.cloud.ssh_identity_file
65
+ #config[:identity_file] ||= svr.server.selected_cloud.ssh_identity_file
66
66
  config[:host_key_verify] ||= Chef::Config[:knife][:host_key_verify] || (not config[:no_host_key_verify]) # pre-vs-post 0.10.4
67
67
 
68
- address = svr.public_hostname
68
+ address = svr.machine.public_hostname
69
69
  if address.blank? && (svr.chef_node)
70
70
  address = format_for_display( svr.chef_node )[config[:attribute]]
71
71
  end
@@ -415,4 +415,14 @@ Chef::Config[:ec2_image_info].merge!({
415
415
  %w[ us-west-2 32-bit instance oneiric ] => { :image_id => 'ami-f49a17c4', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
416
416
  %w[ us-west-2 64-bit ebs oneiric ] => { :image_id => 'ami-ec9a17dc', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
417
417
  %w[ us-west-2 64-bit instance oneiric ] => { :image_id => 'ami-fe9a17ce', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
418
+
419
+
420
+ #
421
+ # Precise (Ubuntu 11.10)
422
+ #
423
+ %w[ us-east-1 32-bit ebs precise ] => { :image_id => 'ami-3b4ff252', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
424
+ %w[ us-east-1 64-bit ebs precise ] => { :image_id => 'ami-3d4ff254', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
425
+ # # These images will only work once http://askubuntu.com/questions/209844/latest-ec2-ubuntu-instance-seems-broken is fixed
426
+ # %w[ us-east-1 32-bit ebs precise ] => { :image_id => 'ami-9878c0f1', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
427
+ # %w[ us-east-1 64-bit ebs precise ] => { :image_id => 'ami-9c78c0f5', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
418
428
  })
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.4.3
5
+ version: 4.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Infochimps
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-10-31 00:00:00 Z
13
+ date: 2012-11-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -161,11 +161,11 @@ files:
161
161
  - config/knife.bash.README.md
162
162
  - config/proxy.pac
163
163
  - config/ubuntu10.04-ironfan.erb
164
- - config/ubuntu11.10-ironfan.erb
164
+ - config/ubuntu12.04-ironfan.erb
165
165
  - ironfan.gemspec
166
166
  - lib/chef/knife/bootstrap/centos6.2-ironfan.erb
167
167
  - lib/chef/knife/bootstrap/ubuntu10.04-ironfan.erb
168
- - lib/chef/knife/bootstrap/ubuntu11.10-ironfan.erb
168
+ - lib/chef/knife/bootstrap/ubuntu12.04-ironfan.erb
169
169
  - lib/chef/knife/cluster_bootstrap.rb
170
170
  - lib/chef/knife/cluster_kick.rb
171
171
  - lib/chef/knife/cluster_kill.rb
@@ -281,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
281
  requirements:
282
282
  - - ">="
283
283
  - !ruby/object:Gem::Version
284
- hash: -706290733514954892
284
+ hash: -130816768739452142
285
285
  segments:
286
286
  - 0
287
287
  version: "0"
@@ -1,161 +0,0 @@
1
- bash <<'EOF' || echo "Chef bootstrap failed!"
2
-
3
- # This is the ubuntu oneiric bootstrap script from infochimps' ironfan. It is
4
- # based on the opscode bootstrap script, with the important differences being it:
5
- #
6
- # * installs ruby 1.9.2 (not 1.8.7) using the system ruby
7
- # * upgrades rubygems rather than installing from source
8
- # * pushes the computer identity into the first-boot.json
9
- # * installs the chef-client service and kicks off the first run of chef
10
-
11
- set -e
12
-
13
- <%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
14
-
15
- RUBY_VERSION=1.9.1
16
- CHEF_VERSION=<%= bootstrap_version_string.gsub(/.*[\s=]/,"") %>
17
-
18
- mkdir -p /tmp/knife-bootstrap
19
- chmod 700 /tmp/knife-bootstrap
20
- cd /tmp/knife-bootstrap
21
-
22
- <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
23
- eval `cat /etc/lsb-release `
24
- export DEBIAN_FRONTEND=noninteractive
25
-
26
- date > /etc/box_build_time
27
-
28
- # source for sun java if you want to install it later
29
- apt-get install --force-yes -y python-software-properties
30
- add-apt-repository -y ppa:ferramroberto/java
31
-
32
- echo -e "`date` \n\n**** \n**** apt update:\n****\n"
33
- apt-get --force-yes -y update
34
- apt-get --force-yes -y upgrade
35
-
36
- echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
37
- apt-get --force-yes -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
38
- apt-get clean
39
-
40
- # do not trust the ubuntu chef package
41
- rm -f /etc/init.d/chef-client || true
42
- apt-get remove -y --force-yes chef ruby1.8-dev libjson-ruby1.8 libmixlib-authentication-ruby1.8 ohai libmixlib-log-ruby1.8 libmime-types-ruby librestclient-ruby1.8 ruby1.8 ruby liberubis-ruby1.8 libsystemu-ruby1.8 libohai-ruby libuuidtools-ruby1.8 libhighline-ruby1.8 libabstract-ruby1.8 libmixlib-config-ruby1.8 rubygems1.8 libbunny-ruby1.8 libchef-ruby1.8 libmixlib-cli-ruby1.8 libyajl-ruby libmoneta-ruby1.8 libohai-ruby1.8 libextlib-ruby1.8 || true
43
- # apt-get remove -y --force-yes --purge myproxy globus-core condor nis autofs myproxy-server globus-proxy-utils globus-repository-natty globus-gridftp-server-progs globus-gass-copy-progs globus-simple-ca globus-gsi-cert-utils-progs || true
44
- sudo apt-get autoremove -y --force-yes || true
45
-
46
- if [ ! -f /usr/bin/chef-client ]; then
47
- echo -e "`date` \n\n**** \n**** Installing ruby version ${RUBY_VERSION}:\n****\n"
48
-
49
- apt-get install --force-yes -y ruby1.9.1 ruby1.9.1-dev
50
-
51
- if ruby -e "exit(%x{gem --version} < \"1.6.2\" ? 0 : -1 )" ; then
52
- echo -e "`date` \n\n**** \n**** Updating rubygems:\n****\n"
53
- # screw you Debian
54
- REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
55
- # screw you rubygems
56
- for foo in /usr/lib/ruby/site_ruby/*/rubygems/deprecate.rb ; do
57
- # Don't have to be any such deprecations, in which case $foo won't exist
58
- [ -f "$foo" ] && sudo sed -i.bak 's!@skip ||= false!true!' "$foo"
59
- done
60
- fi
61
-
62
- echo -e "`date` \n\n**** \n**** Installing chef:\n****\n"
63
- gem install ohai --no-rdoc --no-ri
64
- gem install chef --no-rdoc --no-ri <%= bootstrap_version_string %>
65
- # gems needed for the client.rb or so generically useful you want them at hand
66
- gem install --no-rdoc --no-ri extlib bundler json right_aws pry fog
67
-
68
- else # no chef-client
69
- echo -e "`date` \n\n**** \n**** Chef is present -- skipping apt/ruby/chef installation\n****\n"
70
- fi # end ruby+chef install
71
-
72
- # fix a bug in chef that prevents debugging template errors
73
- # will not work with --prerelease but that's OK hopefully opscode patches this crap soon
74
- bad_template_file="/usr/lib/ruby/gems/${RUBY_VERSION}/gems/chef-${CHEF_VERSION}/lib/chef/mixin/template.rb"
75
- if echo "0505c482b8b0b333ac71bbc8a1795d19 $bad_template_file" | md5sum -c - 2>/dev/null ; then
76
- curl https://github.com/mrflip/chef/commit/655a1967253a8759afb54f30b818bbcb7c309198.patch | sudo patch $bad_template_file
77
- fi
78
-
79
- echo -e "`date` \n\n**** \n**** Knifing in the chef client config files:\n****\n"
80
- mkdir -p /etc/chef
81
-
82
- <%- if @config[:client_key] %>
83
- (
84
- cat <<'EOP'
85
- <%= @config[:client_key] %>
86
- EOP
87
- ) > /tmp/knife-bootstrap/client.pem
88
- awk NF /tmp/knife-bootstrap/client.pem > /etc/chef/client.pem
89
- <%- else %>
90
- (
91
- cat <<'EOP'
92
- <%= validation_key %>
93
- EOP
94
- ) > /tmp/knife-bootstrap/validation.pem
95
- awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
96
- <%- end %>
97
-
98
- <% if @chef_config[:encrypted_data_bag_secret] -%>
99
- (
100
- cat <<'EOP'
101
- <%= encrypted_data_bag_secret %>
102
- EOP
103
- ) > /tmp/encrypted_data_bag_secret
104
- awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
105
- rm /tmp/encrypted_data_bag_secret
106
- <% end -%>
107
-
108
- echo -e "`date` \n\n**** \n**** Nuking our temp files:\n****\n"
109
-
110
- cd /tmp
111
- rm -rf /tmp/knife-bootstrap
112
-
113
- echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
114
-
115
- (
116
- cat <<'EOP'
117
- <%= config_content %>
118
- <%= @config[:computer].chef_client_script_content %>
119
- EOP
120
- ) > /etc/chef/client.rb
121
-
122
- (
123
- cat <<'EOP'
124
- <%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
125
- EOP
126
- ) > /etc/chef/first-boot.json
127
-
128
- echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
129
- ( service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null ) || true
130
- mkdir -p /var/log/chef /var/chef /etc/service /etc/sv/chef-client/{log/main,supervise}
131
- cat > /etc/sv/chef-client/log/run <<'EOP'
132
- #!/bin/bash
133
- exec svlogd -tt ./main
134
- EOP
135
- cat > /etc/sv/chef-client/run <<'EOP'
136
- #!/bin/bash
137
- exec 2>&1
138
- exec /usr/bin/env chef-client -i 43200 -s 20 -L /var/log/chef/client.log
139
- EOP
140
- chmod +x /etc/sv/chef-client/log/run /etc/sv/chef-client/run
141
- ln -nfs /usr/bin/sv /etc/init.d/chef-client
142
-
143
- service chef-client stop >/dev/null 2>&1 || true
144
-
145
- <%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
146
- echo -e "`date` \n\n**** \n**** First run of chef:\n****\n"
147
- set -e
148
- <%= start_chef %>
149
- set +e
150
- <%- end %>
151
-
152
- echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
153
- # make locate work good
154
- updatedb
155
-
156
- echo -e "`date` \n\n**** \n**** Enabling chef client service:\n****\n"
157
- ln -nfs /etc/sv/chef-client /etc/service/chef-client
158
- service chef-client start
159
-
160
- echo -e "`date` \n\n**** \n**** Cluster Chef client bootstrap complete\n****\n"
161
- EOF
@@ -1,161 +0,0 @@
1
- bash <<'EOF' || echo "Chef bootstrap failed!"
2
-
3
- # This is the ubuntu oneiric bootstrap script from infochimps' ironfan. It is
4
- # based on the opscode bootstrap script, with the important differences being it:
5
- #
6
- # * installs ruby 1.9.2 (not 1.8.7) using the system ruby
7
- # * upgrades rubygems rather than installing from source
8
- # * pushes the computer identity into the first-boot.json
9
- # * installs the chef-client service and kicks off the first run of chef
10
-
11
- set -e
12
-
13
- <%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
14
-
15
- RUBY_VERSION=1.9.1
16
- CHEF_VERSION=<%= bootstrap_version_string.gsub(/.*[\s=]/,"") %>
17
-
18
- mkdir -p /tmp/knife-bootstrap
19
- chmod 700 /tmp/knife-bootstrap
20
- cd /tmp/knife-bootstrap
21
-
22
- <%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
23
- eval `cat /etc/lsb-release `
24
- export DEBIAN_FRONTEND=noninteractive
25
-
26
- date > /etc/box_build_time
27
-
28
- # source for sun java if you want to install it later
29
- apt-get install --force-yes -y python-software-properties
30
- add-apt-repository -y ppa:ferramroberto/java
31
-
32
- echo -e "`date` \n\n**** \n**** apt update:\n****\n"
33
- apt-get --force-yes -y update
34
- apt-get --force-yes -y upgrade
35
-
36
- echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
37
- apt-get --force-yes -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
38
- apt-get clean
39
-
40
- # do not trust the ubuntu chef package
41
- rm -f /etc/init.d/chef-client || true
42
- apt-get remove -y --force-yes chef ruby1.8-dev libjson-ruby1.8 libmixlib-authentication-ruby1.8 ohai libmixlib-log-ruby1.8 libmime-types-ruby librestclient-ruby1.8 ruby1.8 ruby liberubis-ruby1.8 libsystemu-ruby1.8 libohai-ruby libuuidtools-ruby1.8 libhighline-ruby1.8 libabstract-ruby1.8 libmixlib-config-ruby1.8 rubygems1.8 libbunny-ruby1.8 libchef-ruby1.8 libmixlib-cli-ruby1.8 libyajl-ruby libmoneta-ruby1.8 libohai-ruby1.8 libextlib-ruby1.8 || true
43
- # apt-get remove -y --force-yes --purge myproxy globus-core condor nis autofs myproxy-server globus-proxy-utils globus-repository-natty globus-gridftp-server-progs globus-gass-copy-progs globus-simple-ca globus-gsi-cert-utils-progs || true
44
- sudo apt-get autoremove -y --force-yes || true
45
-
46
- if [ ! -f /usr/bin/chef-client ]; then
47
- echo -e "`date` \n\n**** \n**** Installing ruby version ${RUBY_VERSION}:\n****\n"
48
-
49
- apt-get install --force-yes -y ruby1.9.1 ruby1.9.1-dev
50
-
51
- if ruby -e "exit(%x{gem --version} < \"1.6.2\" ? 0 : -1 )" ; then
52
- echo -e "`date` \n\n**** \n**** Updating rubygems:\n****\n"
53
- # screw you Debian
54
- REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
55
- # screw you rubygems
56
- for foo in /usr/lib/ruby/site_ruby/*/rubygems/deprecate.rb ; do
57
- # Don't have to be any such deprecations, in which case $foo won't exist
58
- [ -f "$foo" ] && sudo sed -i.bak 's!@skip ||= false!true!' "$foo"
59
- done
60
- fi
61
-
62
- echo -e "`date` \n\n**** \n**** Installing chef:\n****\n"
63
- gem install ohai --no-rdoc --no-ri
64
- gem install chef --no-rdoc --no-ri <%= bootstrap_version_string %>
65
- # gems needed for the client.rb or so generically useful you want them at hand
66
- gem install --no-rdoc --no-ri extlib bundler json right_aws pry fog
67
-
68
- else # no chef-client
69
- echo -e "`date` \n\n**** \n**** Chef is present -- skipping apt/ruby/chef installation\n****\n"
70
- fi # end ruby+chef install
71
-
72
- # fix a bug in chef that prevents debugging template errors
73
- # will not work with --prerelease but that's OK hopefully opscode patches this crap soon
74
- bad_template_file="/usr/lib/ruby/gems/${RUBY_VERSION}/gems/chef-${CHEF_VERSION}/lib/chef/mixin/template.rb"
75
- if echo "0505c482b8b0b333ac71bbc8a1795d19 $bad_template_file" | md5sum -c - 2>/dev/null ; then
76
- curl https://github.com/mrflip/chef/commit/655a1967253a8759afb54f30b818bbcb7c309198.patch | sudo patch $bad_template_file
77
- fi
78
-
79
- echo -e "`date` \n\n**** \n**** Knifing in the chef client config files:\n****\n"
80
- mkdir -p /etc/chef
81
-
82
- <%- if @config[:client_key] %>
83
- (
84
- cat <<'EOP'
85
- <%= @config[:client_key] %>
86
- EOP
87
- ) > /tmp/knife-bootstrap/client.pem
88
- awk NF /tmp/knife-bootstrap/client.pem > /etc/chef/client.pem
89
- <%- else %>
90
- (
91
- cat <<'EOP'
92
- <%= validation_key %>
93
- EOP
94
- ) > /tmp/knife-bootstrap/validation.pem
95
- awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
96
- <%- end %>
97
-
98
- <% if @chef_config[:encrypted_data_bag_secret] -%>
99
- (
100
- cat <<'EOP'
101
- <%= encrypted_data_bag_secret %>
102
- EOP
103
- ) > /tmp/encrypted_data_bag_secret
104
- awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
105
- rm /tmp/encrypted_data_bag_secret
106
- <% end -%>
107
-
108
- echo -e "`date` \n\n**** \n**** Nuking our temp files:\n****\n"
109
-
110
- cd /tmp
111
- rm -rf /tmp/knife-bootstrap
112
-
113
- echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
114
-
115
- (
116
- cat <<'EOP'
117
- <%= config_content %>
118
- <%= @config[:computer].chef_client_script_content %>
119
- EOP
120
- ) > /etc/chef/client.rb
121
-
122
- (
123
- cat <<'EOP'
124
- <%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
125
- EOP
126
- ) > /etc/chef/first-boot.json
127
-
128
- echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
129
- ( service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null ) || true
130
- mkdir -p /var/log/chef /var/chef /etc/service /etc/sv/chef-client/{log/main,supervise}
131
- cat > /etc/sv/chef-client/log/run <<'EOP'
132
- #!/bin/bash
133
- exec svlogd -tt ./main
134
- EOP
135
- cat > /etc/sv/chef-client/run <<'EOP'
136
- #!/bin/bash
137
- exec 2>&1
138
- exec /usr/bin/env chef-client -i 43200 -s 20 -L /var/log/chef/client.log
139
- EOP
140
- chmod +x /etc/sv/chef-client/log/run /etc/sv/chef-client/run
141
- ln -nfs /usr/bin/sv /etc/init.d/chef-client
142
-
143
- service chef-client stop >/dev/null 2>&1 || true
144
-
145
- <%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
146
- echo -e "`date` \n\n**** \n**** First run of chef:\n****\n"
147
- set -e
148
- <%= start_chef %>
149
- set +e
150
- <%- end %>
151
-
152
- echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
153
- # make locate work good
154
- updatedb
155
-
156
- echo -e "`date` \n\n**** \n**** Enabling chef client service:\n****\n"
157
- ln -nfs /etc/sv/chef-client /etc/service/chef-client
158
- service chef-client start
159
-
160
- echo -e "`date` \n\n**** \n**** Cluster Chef client bootstrap complete\n****\n"
161
- EOF