-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The SSL certificate will be named 'chef-server.crt' by default - Disabled non SSH traffic (HTTP requests to SSL port will fail) - Moved all the Chef configuration commands out of 'run.sh'
- Loading branch information
Showing
3 changed files
with
35 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
#/bin/bash -x | ||
|
||
cat > /etc/opscode/chef-server.rb << EOL | ||
nginx['enable_non_ssl']=false | ||
nginx['ssl_port']=$CHEF_PORT | ||
EOL | ||
if [[ ! -z $CONTAINER_NAME ]]; then | ||
echo "nginx['server_name']=\"$CONTAINER_NAME\"" >> /etc/opscode/chef-server.rb | ||
else | ||
echo "nginx['server_name']=\"chef-server\"" >> /etc/opscode/chef-server.rb | ||
fi | ||
|
||
chef-server-ctl reconfigure |tee /root/out.txt | ||
|
||
URL="http://127.0.0.1:8000/_status" | ||
|
@@ -32,8 +42,8 @@ if [[ -z "$return" ]]; then | |
echo "$URL is not available after $SECONDS seconds...stopping the script!" |tee -a /root/out.txt | ||
exit 1 | ||
fi | ||
|
||
done; | ||
|
||
echo -e "\n\n$URL is available!\n" |tee -a /root/out.txt | ||
echo -e "\nSetting up admin user and default organization" |tee -a /root/out.txt | ||
chef-server-ctl user-create admin Admin User [email protected] "passwd" --filename /etc/chef/admin.pem |tee -a /root/out.txt | ||
|
@@ -42,4 +52,14 @@ if [[ -z "$return" ]]; then | |
chef-server-ctl install chef-manage |tee -a /root/out.txt | ||
echo -e "\nRunning: chef-server-ctl reconfigure" |tee -a /root/out.txt | ||
chef-server-ctl reconfigure |tee -a /root/out.txt | ||
echo "{ \"error\": \"Please use https:// instead of http:// !\" }" > /var/opt/opscode/nginx/html/500.json | ||
sed -i "s,/503.json;,/503.json;\n error_page 497 =503 /500.json;,g" /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
sed -i '$i\ location /knife_admin_key.tar.gz {\n default_type application/zip;\n alias /etc/chef/knife_admin_key.tar.gz;\n }' /var/opt/opscode/nginx/etc/chef_https_lb.conf | ||
echo -e "\nCreating tar file with the Knife keys" |tee -a /root/out.txt | ||
cd /etc/chef/ && tar -cvzf knife_admin_key.tar.gz admin.pem admin-validator.pem | ||
echo -e "\nRestart Nginx..." |tee -a /root/out.txt | ||
chef-server-ctl restart nginx | ||
chef-server-ctl status |tee -a /root/out.txt | ||
touch /root/chef_configured | ||
echo -e "\n\nDone!\n" |tee -a /root/out.txt | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters