--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# -*- mode: ruby -*-# vi: set ft=ruby :# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!VAGRANTFILE_API_VERSION = "2"Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|config.vm.box = "centos64"# ---Chef Server---config.vm.define :chef do |chef|chef.vm.hostname = 'server'chef.vm.network "public_network", ip: "10.0.1.230"chef.vm.provision :shell, :path => "centos6x_chefserver.sh"chef.vm.provider "virtualbox" do |chefvb|chefvb.customize ["modifyvm", :id, "--memory", "1024"]endendend
#!/bin/bash
# This script deploys the Chef Server and copies the keys out to use in the host environment.
rpm_file_name="chef-server-core-12.0.1-1.x86_64.rpm"
rpm_web_location="https://s3.amazonaws.com/rise-chef/$rpm_file_name"
#Setup the variables for deployment.
#Vagrant deployments in a development environment do things slightly differently
if [ -d '/vagrant' ]
then
if [ ! -f "/vagrant/$rpm_file_name" ]
then
echo "The chef server RPM has not yet been cached. Downloading it"
curl -o "/vagrant/$rpm_file_name" $rpm_web_location
fi
rpm_location="/vagrant/$rpm_file_name"
vagrant=true
else
rpm_location="$rpm_web_location"
vagrant=false
fi
#Deploy chef server is not already deployed
if [ ! -d '/opt/opscode' ]
then
echo "Installing the Chef Server"
# usually rpm -Uvh
rpm -Uvh $rpm_location
#Setup the puppet master
chef-server-ctl reconfigure
else
echo "Chef already setup... Skipping setup step"
fi
# Once the Chef server is setup, copy the admin user key and validator key out
if [ ! -f '/etc/chef/admin.pem' ]
then
#Create an administrator
echo "Creating the administrator account"
chef-server-ctl user-create admin Administrator Administrator admini...@gmail.com password --filename /etc/chef/admin.pem
echo "Administrator account created"
fi
if [ ! -f '/etc/chef/org.pem' ]
then
#Create an organization
echo "Creating the Rise organization"
chef-server-ctl org-create org Organization --association_user admin --filename /etc/chef/org.pem
echo "org organization created"
fi
if [ "$vagrant" = true ]
then
if [ ! -d '/chef/chef-keys' ]
then
echo "Creating directory to copy admin keys into"
mkdir /chef/chef-keys
fi
echo "Copying private keys over to host"
cp /etc/chef/admin.pem /chef/chef-keys/
cp /etc/chef/rise.pem /chef/chef-keys/
else
echo "Chef Server is deployed. You will want to copy these files off for your workstation"
echo "/etc/chef-server/admin.pem"
echo "/etc/chef-server/chef-validator.pem"
fi
chef-server-ctl user-create admin Administrator Administrator administrator@gmail.com password --filename /etc/chef/admin.pem
--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/6fc-rBhl84M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.