Do you know which part of that script is failing? Do you have a line number or 
anything? Debug output from the Chef installation?

Best,
Seth

> On Jan 6, 2015, at 9:57 PM, Mihael Keehl <[email protected]> wrote:
> 
> # -*- 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"]
>     end
>   end
> 
> end
> 
> and here is the script file:
> 
> #!/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 
> <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 
> [email protected] <http://administrator.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
> 
> On Tuesday, January 6, 2015 11:03:09 PM UTC+8, Seth Vargo wrote:
> What user are you running them as? Vagrant is not a tty, which could affect 
> those scripts, but I don't think that's the problem. Can you share your 
> complete vagrantfile please? Can you set the chef log-level to debug and see 
> if there's anything interesting in that output?
> 
> Best,
> Seth
> 
>> On Jan 6, 2015, at 5:23 AM, Mihael Keehl <[email protected] <javascript:>> 
>> wrote:
>> 
>> I'm having problems running 2 lines on my script file via vagrant.
>> 
>> These commands are:
>> chef-server-ctl user-create and chef-server-ctl org-create. I tried manually 
>> executing the commands on the terminal and they work. However, when I run it 
>> as a provision to a vagrant box, I get the error message:
>> 
>> ==> chef: the ffi-yajl and yajl-ruby gems have incompatible C libyajl libs 
>> and should not be loaded in the same Ruby VM
>> ==> chef: falling back to ffi which might work (or might not, no promises)
>> ==> chef: ffi-yajl/json_gem is deprecated, these monkeypatches will be 
>> dropped shortly
>> ==> chef: Response: <html>
>> ==> chef: <head><title>502 Bad Gateway</title></head>
>> ==> chef: <body bgcolor="white">
>> ==> chef: <center><h1>502 Bad Gateway</h1></center>
>> ==> chef: <hr><center>ngx_openresty/1.4.3.6 <http://1.4.3.6/></center>
>> ==> chef: </body>
>> ==> chef: </html>
>> ==> chef: ERROR: bad gateway
>> 
>> Does anybody know how I can get through this?
>> 
>> 
>> Thanks,
>> Mihael
>> 
>> -- 
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to