Skip to content

Instantly share code, notes, and snippets.

@geedelur
Last active January 15, 2018 21:35
Show Gist options
  • Save geedelur/84dc954f181c77678717 to your computer and use it in GitHub Desktop.
Save geedelur/84dc954f181c77678717 to your computer and use it in GitHub Desktop.
vagrant librarian chef windows

Vagrant + Librarian + Chef on Windows

Steps

  1. http://www.vagrantup.com/downloads.html
  2. Download and install vagrant_1.6.3.msi
  3. Reboot
  4. [run] vagrant box add opscode_ubuntu-12.04_chef-11.4.0 https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.0.box
  5. http://gnuwin32.sourceforge.net/packages/gtar.htm
  1. http://rubyinstaller.org/downloads/

  2. Ruby 1.9.3-p545 1. Install in C:\Ruby193

  3. DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe 1. Extract in C:\Ruby193\DevKit 2. [run] cd C:\Ruby193\DevKit 3. [run] ruby dk.rb init 4. [run] ruby dk.rb install

  4. [run] gem install librarian -v 0.1.2 --no-ri --no-rdoc

  5. [run] gem install librarian-chef -v 0.0.3 --no-ri --no-rdoc

  6. Go to your proyect folder (for example cd C:\project)

  7. [run] librarian-chef init

  8. Add your recipes to the Cheffile, for example:

      #!/usr/bin/env ruby
      #^syntax detection
      site 'http://community.opscode.com/api/v1'
      cookbook 'mysql', '= 5.3.6'
  9. [run] librarian-chef install

  10. [run] vagrant init

  11. Configure yout Vagrantfile and add your recipes, for example:

    # encoding: utf-8
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure("2") do |config|
    
        config.vm.box = "opscode_ubuntu-12.04_chef-11.4.0"
    
        config.ssh.forward_agent = true
    
        config.vm.network :forwarded_port, guest: 3306, host: 3307
    
        config.vm.synced_folder "dev/", "/var/www/nginx-default"
    
        config.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = ["cookbooks"]
            chef.add_recipe 'mysql::server'
            chef.json = {
                :mysql => {
                    :server_root_password => 'thepass',
                    :allow_remote_root    => true
                }
            }
        end
    end
  12. [run] vagrant up

Notes

If you get an error message like while installing recipes:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

Install the certified gem (https://github.com/stevegraham/certified)

gem install certified

And add to the Cheffile

require 'certified'

-- OR --

Download and copy to your user folder the following certificate:

And add the SSL_CERT_FILE environment variable:

  • set SSL_CERT_FILE=C:\Users\YOURUSER\ca-bundle.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment