cucumber-chef 3.0.0.rc.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,213 +0,0 @@
1
- #!/bin/env bash
2
- #
3
- # Cucumber-Chef 'Chef < 11.0.0' Bootstrap Script
4
- #
5
- # Generated <%= Time.now.utc %>
6
- #
7
- set -x
8
-
9
- CUCUMBER_CHEF_BOOTSTRAP_DONE="/.cucumber-chef-bootstrap-finished"
10
- # [ -f ${CUCUMBER_CHEF_BOOTSTRAP_DONE} ] && echo "Already bootstrapped!" && exit
11
-
12
- export DEBIAN_FRONTEND=noninteractive
13
- cd /tmp
14
-
15
- echo "127.0.0.1 <%= @hostname_full %> <%= @hostname_short %>" | tee -a /etc/hosts
16
- echo "<%= @hostname_full %>" | tee /etc/hostname
17
- hostname <%= @hostname_full %>
18
-
19
- echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
20
- mkdir -p /etc/apt/trusted.gpg.d
21
- gpg --fetch-key http://apt.opscode.com/packages@opscode.com.gpg.key
22
- gpg --export packages@opscode.com | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
23
- apt-get -y --force-yes update
24
- apt-get -y --force-yes -o Dpkg::Options::="--force-confnew" install opscode-keyring
25
- apt-get -y --force-yes update
26
- chown -R ${SUDO_USER}:${SUDO_USER} ${HOME}/.gnupg
27
-
28
- cat <<EOF | debconf-set-selections
29
- chef chef/chef_server_url string http://<%= @hostname_short %>:4000
30
- chef-solr chef-solr/amqp_password password <%= @amqp_password %>
31
- chef-server-webui chef-server-webui/admin_password password <%= @admin_password %>
32
- EOF
33
-
34
- CHEF_CLIENT_VERSION=`apt-cache showpkg chef | tee | grep -m 1 "<%= @chef_server_version %>" | cut -c -<%= @chef_server_version.length + 3 %>`
35
- CHEF_SERVER_VERSION=`apt-cache showpkg chef-server | tee | grep -m 1 "<%= @chef_server_version %>" | cut -c -<%= @chef_server_version.length + 3 %>`
36
-
37
- apt-get -y --force-yes install chef=$CHEF_CLIENT_VERSION chef-server=$CHEF_SERVER_VERSION
38
-
39
- echo -n "Waiting on validation.pem and webui.pem to appear..."
40
- until [ -f /etc/chef/validation.pem ] && [ -f /etc/chef/webui.pem ]; do
41
- echo -n "."
42
- sleep 1
43
- done
44
- echo "done."
45
-
46
- mkdir -p ~/.chef
47
- cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
48
- knife configure -i --server-url http://127.0.0.1:4000 -u ${SUDO_USER} -r '' --defaults --disable-editing --yes -VV
49
- knife client create <%= @user %> -a -f ${HOME}/.chef/<%= @user %>.pem --disable-editing --yes -VV
50
- chown -R ${SUDO_USER}:${SUDO_USER} ${HOME}
51
-
52
- if [ ! -f /etc/chef/client.pem ]; then
53
- /etc/init.d/chef-client restart
54
- echo -n "Waiting on client.pem to appear..."
55
- i="0"
56
- until [ -f /etc/chef/client.pem ]; do
57
- i=$[$i+1]
58
- sleep 1
59
- echo -n "."
60
- if [ $i -gt 60 ]; then
61
- echo -n "restart-chef-client"
62
- /etc/init.d/chef-client restart
63
- i="0"
64
- fi
65
- done
66
- echo "done."
67
- fi
68
-
69
- cat <<EOF > /tmp/chef-solo/Gemfile
70
- source 'https://rubygems.org'
71
- gem 'chef', '<%= @chef_client_version %>'
72
- gem 'librarian-chef'
73
- EOF
74
-
75
- cat <<EOF > /tmp/chef-solo/Cheffile
76
- site 'http://community.opscode.com/api/v1'
77
- cookbook 'chef-server'
78
- cookbook 'chef-client'
79
- EOF
80
-
81
- cd /tmp/chef-solo
82
- mv cookbooks site-cookbooks
83
- gem install bundler --no-ri --no-rdoc
84
- bundle install
85
- librarian-chef install
86
- cd /tmp
87
-
88
- knife cookbook upload --all --cookbook-path /tmp/chef-solo/cookbooks:/tmp/chef-solo/site-cookbooks --force --yes -VV
89
- knife role from file /tmp/chef-solo/roles/*.rb --yes -VV
90
-
91
- cat <<EOF > /etc/chef/bootstrap-chef-client.json
92
- <%= @chef_client_attributes.to_json %>
93
- EOF
94
- chef-client -j /etc/chef/bootstrap-chef-client.json
95
-
96
- touch ${CUCUMBER_CHEF_BOOTSTRAP_DONE}
97
-
98
-
99
-
100
- # #!/bin/env bash
101
- # #
102
- # # Cucumber-Chef Bootstrap Script
103
- # #
104
- # # Generated <%= Time.now.utc %>
105
- # #
106
- # set -x
107
-
108
- # CUCUMBER_CHEF_BOOTSTRAP_DONE="/.cucumber-chef-bootstrap-finished"
109
- # [ -f ${CUCUMBER_CHEF_BOOTSTRAP_DONE} ] && echo "Already bootstrapped!" && exit
110
-
111
- # export DEBIAN_FRONTEND=noninteractive
112
-
113
- # mkdir -p $HOME/.ssh/
114
- # cat <<EOF > $HOME/.ssh/config
115
- # UserKnownHostsFile /dev/null
116
- # StrictHostKeyChecking no
117
- # ForwardAgent yes
118
- # EOF
119
-
120
- # mkdir -p /root/.ssh/
121
- # cp -v $HOME/.ssh/config /root/.ssh/config
122
-
123
- # echo "127.0.0.1 <%= @hostname_full %> <%= @hostname_short %>" | tee -a /etc/hosts
124
- # echo "<%= @hostname_full %>" | tee /etc/hostname
125
- # hostname <%= @hostname_full %>
126
-
127
- # apt-get -y --force-yes update
128
- # apt-get -y --force-yes install build-essential rpm ruby1.9.3 # git-core #ruby-full rubygems git-core
129
- # #rpm ruby1.9.3 # ruby-libxml
130
-
131
- # wget http://www.opscode.com/chef/install.sh
132
- # bash install.sh -v <%= @chef_server_version %>
133
- # # rpm -Uvh --nodeps /tmp/*rpm
134
- # # export PATH=/opt/chef/embedded/bin/:$PATH
135
-
136
- # mkdir -p /etc/chef/
137
- # mkdir -p /var/log/chef/
138
-
139
- # cat <<EOF > /etc/chef/solo.rb
140
- # file_cache_path "/tmp/chef-solo/"
141
- # cookbook_path %w(/tmp/chef-solo/cookbooks/ /tmp/chef-solo/site-cookbooks/)
142
- # role_path "/tmp/chef-solo/roles/"
143
- # EOF
144
-
145
- # cat <<EOF > /etc/chef/bootstrap-chef-client.json
146
- # <%= @chef_client_attributes.to_json %>
147
- # EOF
148
-
149
- # cat <<EOF > /tmp/chef-solo/Gemfile
150
- # source 'https://rubygems.org'
151
- # gem 'chef', '<%= @chef_server_version %>'
152
- # gem 'berkshelf'
153
- # gem 'moneta', '< 0.7.0'
154
- # EOF
155
-
156
- # cat <<EOF > /tmp/chef-solo/Berksfile
157
- # site :opscode
158
- # cookbook 'chef-server'
159
- # EOF
160
-
161
- # cd /tmp/chef-solo/
162
-
163
- # gem install bundler --no-ri --no-rdoc
164
- # # bundle install --standalone --path vendor/bundle --binstubs
165
- # bundle install
166
- # # bin/librarian-chef install
167
- # # librarian-chef install
168
- # berks install --path /tmp/chef-solo/cookbooks/
169
-
170
- # # git clone git://github.com/opscode-cookbooks/chef-server.git /tmp/chef-solo/cookbooks/chef-server --branch
171
-
172
- # chef-solo --config /etc/chef/solo.rb --json-attributes /etc/chef/bootstrap-chef-solo.json --logfile /var/log/chef/chef-solo.log
173
-
174
- # echo -n "Waiting on validation.pem and webui.pem to appear..."
175
- # until [ -f /etc/chef/validation.pem ] && [ -f /etc/chef/webui.pem ]; do
176
- # echo -n "."
177
- # sleep 1
178
- # done
179
- # echo "done."
180
-
181
- # mkdir -p ~/.chef
182
- # cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
183
-
184
- # # apt-get -q -y install expect
185
- # # KNIFE_CONFIG_EXP_FILE="/tmp/knife-config.exp"
186
- # # cat <<EOF > ${KNIFE_CONFIG_EXP_FILE}
187
- # # #!/usr/bin/expect -f
188
- # # set timeout 10
189
- # # spawn knife configure -i
190
- # # expect "Overwrite ${HOME}/.chef/knife.rb" { send "Y\n" }
191
- # # expect "Where should I put the config file?" { send "\n" }
192
- # # expect "Please enter the chef server URL" { send "\n" }
193
- # # expect "Please enter a clientname for the new client" { send "${SUDO_USER}\n" }
194
- # # expect "Please enter the existing admin clientname" { send "\n" }
195
- # # expect "Please enter the location of the existing admin client" { send "${HOME}/.chef/webui.pem\n" }
196
- # # expect "Please enter the validation clientname" { send "\n" }
197
- # # expect "Please enter the location of the validation key" { send "${HOME}/.chef/validation.pem\n" }
198
- # # expect "Please enter the path to a chef repository" { send "${HOME}/chef_repo\n" }
199
- # # interact
200
- # # EOF
201
- # # chmod +x ${KNIFE_CONFIG_EXP_FILE}
202
- # # ${KNIFE_CONFIG_EXP_FILE}
203
- # # run("#{try_sudo} knife configure -i -n -y -s http://localhost:4000 -u root -r '' --defaults", :hosts => server)
204
-
205
- # knife configure -i --server-url http://127.0.0.1:4000 -u ${SUDO_USER} --defaults --disable-editing --yes -VV
206
- # knife client create <%= @user %> -a -f ${HOME}/.chef/<%= @user %>.pem --disable-editing --yes -VV
207
- # chown -Rv ${SUDO_USER}:${SUDO_USER} ${HOME}
208
-
209
- # # knife cookbook upload --all --cookbook-path /tmp/chef-solo/cookbooks:/tmp/chef-solo/site-cookbooks --force --yes -VV
210
- # # knife role from file /tmp/chef-solo/roles/*.rb --yes -VV
211
- # # chef-client -j /etc/chef/bootstrap-chef-client.json
212
-
213
- # touch ${CUCUMBER_CHEF_BOOTSTRAP_DONE}