Is Berkshelf vagrant plugin are usable only with a application cookbooks instead of pure site cookbooks?


#1

Now I suppose to use Berks and reading documentation at off site.

Most important information on off site wiki is to use vagrant berks plugin.

I was never used vagrant, but I want to use recently (near future).

Is Berkshelf vagrant plugin are usable with a application cookbooks
instead of pure site cookbooks (Is I’am right)?

I cannot undertsand how they are related ?

Vagrant do a provision, Berks do a manipulation with cookbooks, download
it from anywhere and puts in configured directory.

What else it does ?


Best regards,

CVision Lab System Administrator
Vladmir Skubriev


#2

Vladimir,

we use Vagrant + Virtual Box + Berkshelf in the developers machines
(windows7 & Ubuntu) to test the cookbook before commit it in the
repository. My Linux Ubuntu 12.04 I used the configuration below:

Install RVM:
For a Multi-User install you would execute the following:
curl --proxy http://web-proxy.corp.hp.com:8080 -L https://get.rvm.io | sudo
bash -s stable

Reload your profile:
source /etc/profile or source ~/.profile

Install and select the appropriated Ruby version:
rvm install 1.9.3
rvm use 1.9.3 --default

Install required gems:
gem install berkshelf
gem install chef
gem install minitest-chef-handler
gem install rest-client

Install Vagrant:
wget
http://files.vagrantup.com/packages/7e400d00a3c5a0fdf2809c8b5001a035415a607b/vagrant_1.2.2_x86_64.deb
sudo dpkg -i vagrant_1.2.2_x86_64.deb

Configure Vagrant plugins:
vagrant plugin install vagrant-berkshelf
vagrant plugin install rest-client
vagrant plugin install vagrant-proxyconf (only if you need a proxy)

Install VirtualBox:
sudo apt-get install virtualbox

Create a file named config.json in ~/.berkshelf:
{
“ssl”: {
“verify”: false
}
}

Good Lucky.

Eduardo

2013/10/30 Vladimir Skubriev skubriev@cvisionlab.com

Now I suppose to use Berks and reading documentation at off site.

Most important information on off site wiki is to use vagrant berks plugin.

I was never used vagrant, but I want to use recently (near future).

Is Berkshelf vagrant plugin are usable with a application cookbooks
instead of pure site cookbooks (Is I’am right)?

I cannot undertsand how they are related ?

Vagrant do a provision, Berks do a manipulation with cookbooks, download
it from anywhere and puts in configured directory.

What else it does ?


Best regards,

CVision Lab System Administrator
Vladmir Skubriev

Atenciosamente,

Eduardo


#3

30.10.2013 16:47, Eduardo Dias пишет:

Vladimir,

we use Vagrant + Virtual Box + Berkshelf in the developers machines
(windows7 & Ubuntu) to test the cookbook before commit it in the
repository. My Linux Ubuntu 12.04 I used the configuration below:

Install RVM:
For a Multi-User install you would execute the following:
curl --proxy http://web-proxy.corp.hp.com:8080 -L https://get.rvm.io |
sudo bash -s stable

Reload your profile:
source /etc/profile or source ~/.profile

Install and select the appropriated Ruby version:
rvm install 1.9.3
rvm use 1.9.3 --default

Install required gems:
gem install berkshelf
gem install chef
gem install minitest-chef-handler
gem install rest-client

Install Vagrant:
wget
http://files.vagrantup.com/packages/7e400d00a3c5a0fdf2809c8b5001a035415a607b/vagrant_1.2.2_x86_64.deb
sudo dpkg -i vagrant_1.2.2_x86_64.deb

Configure Vagrant plugins:
vagrant plugin install vagrant-berkshelf
vagrant plugin install rest-client
vagrant plugin install vagrant-proxyconf (only if you need a proxy)

Install VirtualBox:
sudo apt-get install virtualbox

Create a file named config.json in ~/.berkshelf:
{
“ssl”: {
“verify”: false
}
}

Good Lucky.

Eduardo

Ok I am do most of that you mail me. What’s next ?

$ vagrant up ?


Best regards,

CVision Lab System Administrator
Vladmir Skubriev


#4

You need to download a box (like ubuntu), create a vagrant file, and
vagrant up.
vagrant box add (look at Vagrant to get the corerct url)

Simple Vargrant file:

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.hostname = "<server_name>"
config.vm.box = "<box_name>"
config.berkshelf.enabled = true

the lines below is to forward ports

config.vm.network :forwarded_port, host: 8080, guest: 8080
config.vm.network :forwarded_port, host: 8443, guest: 8443

the line below must be used if you need to sync a local directory with

the remote
config.vm.synced_folder “…/…/”, "/repo"
config.vm.provision :chef_solo do |chef|

the line below is used if you need a proxy

config.proxy.http = “http://web-proxy.corp.hp.com:8080/

config.proxy.https = “http://web-proxy.corp.hp.com:8080/

the chef .son you use to pass attributes that you need to rewrite if you

use Vagrant for example.
chef.json = {
}
chef.run_list = [
“recipe[xxxx::default]”,
“recipe[minitest-handler::default]”
]
end
end

vagrant ssh --> to connect to the provisioned system

The vagrant up, destroy, reload, ssh must be ran at the same directory that
you have Vagrant file

Eduardo

2013/10/30 Vladimir Skubriev skubriev@cvisionlab.com

30.10.2013 16:47, Eduardo Dias пишет:

Vladimir,

we use Vagrant + Virtual Box + Berkshelf in the developers machines
(windows7 & Ubuntu) to test the cookbook before commit it in the
repository. My Linux Ubuntu 12.04 I used the configuration below:

Install RVM:
For a Multi-User install you would execute the following:
curl --proxy http://web-proxy.corp.hp.com:**8080http://web-proxy.corp.hp.com:8080-L
https://get.rvm.io | sudo bash -s stable

Reload your profile:
source /etc/profile or source ~/.profile

Install and select the appropriated Ruby version:
rvm install 1.9.3
rvm use 1.9.3 --default

Install required gems:
gem install berkshelf
gem install chef
gem install minitest-chef-handler
gem install rest-client

Install Vagrant:
wget http://files.vagrantup.com/packages/
7e400d00a3c5a0fdf2809c8b5001a0**35415a607b/vagrant_1.2.2_x86_**64.debhttp://files.vagrantup.com/packages/7e400d00a3c5a0fdf2809c8b5001a035415a607b/vagrant_1.2.2_x86_64.deb
sudo dpkg -i vagrant_1.2.2_x86_64.deb

Configure Vagrant plugins:
vagrant plugin install vagrant-berkshelf
vagrant plugin install rest-client
vagrant plugin install vagrant-proxyconf (only if you need a proxy)

Install VirtualBox:
sudo apt-get install virtualbox

Create a file named config.json in ~/.berkshelf:
{
“ssl”: {
“verify”: false
}
}

Good Lucky.

Eduardo

Ok I am do most of that you mail me. What’s next ?

$ vagrant up ?


Best regards,

CVision Lab System Administrator
Vladmir Skubriev

Atenciosamente,

Eduardo


#5

30.10.2013 17:05, Eduardo Dias пишет:

You need to download a box (like ubuntu), create a vagrant file, and
vagrant up.
vagrant box add (look at Vagrant to get the corerct url)

Simple Vargrant file:

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.hostname = "<server_name>"
config.vm.box = "<box_name>"
config.berkshelf.enabled = true

To be honest I can not understand: “What is the role of plugin enabled
by config.berkshelf.enabled = true ?”

or

What is the role of berks in virtual machine created by vagrant, with
config defined option config.berkshelf.enabled = true ?

  1. This is for testing cookbooks with chef-solo on workstation?

  2. To upload defined in Berksfile cookbooks(from working machine or
    somewhere else but with berks instead of chef-client) in a
    virtualmachine provisioned by vagrant ?

So I used opensource chef-server in our localnetwork. And most of all
i’am interested in deploy our and community cookbooks on production
virtual machines (lxc).

May be my questions is not good. May be I need some time to read a
documentation of berks and vagrant. There is no doubt of course.

Why not use only vagrant with defined chef cookbooks ?

Thank youf or help.

the lines below is to forward ports

config.vm.network :forwarded_port, host: 8080, guest: 8080
config.vm.network :forwarded_port, host: 8443, guest: 8443

the line below must be used if you need to sync a local directory

with the remote
config.vm.synced_folder “…/…/”, "/repo"
config.vm.provision :chef_solo do |chef|

the line below is used if you need a proxy

config.proxy.http = “http://web-proxy.corp.hp.com:8080/

config.proxy.https = “http://web-proxy.corp.hp.com:8080/

the chef .son you use to pass attributes that you need to rewrite if

you use Vagrant for example.
chef.json = {
}
chef.run_list = [
“recipe[xxxx::default]”,
“recipe[minitest-handler::default]”
]
end
end

vagrant ssh --> to connect to the provisioned system

The vagrant up, destroy, reload, ssh must be ran at the same directory
that you have Vagrant file

Eduardo


Best regards,

CVision Lab System Administrator
Vladmir Skubriev


#6

Look, Berkshelf you use to solve dependencies, Vagrant you use for
chef-solo, and Virtualbox is your virtual machines. Then, what I ma
proposing it to put all working together.

  1. This is for testing cookbooks with chef-solo on workstation? Yes
  2. To upload defined in Berksfile cookbooks(from working machine or
    somewhere else but with berks instead of chef-client) in a virtual machine
    provisioned by vagrant ? Yes
    Why not use only vagrant with defined chef cookbooks ?
    if you use chef-solo you use Vagrant + Virtual Box, if you want to deploy
    in the cloud you need to configure Vagrant file with other config , but
    always Berkshelf will be present.

2013/10/30 Vladimir Skubriev skubriev@cvisionlab.com

30.10.2013 17:05, Eduardo Dias пишет:

You need to download a box (like ubuntu), create a vagrant file, and

vagrant up.
vagrant box add (look at Vagrant to get the corerct url)

Simple Vargrant file:

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.hostname = "<server_name>"
config.vm.box = "<box_name>"
config.berkshelf.enabled = true

To be honest I can not understand: “What is the role of plugin enabled
by config.berkshelf.enabled = true ?”

or

What is the role of berks in virtual machine created by vagrant, with
config defined option config.berkshelf.enabled = true ?

  1. This is for testing cookbooks with chef-solo on workstation?

  2. To upload defined in Berksfile cookbooks(from working machine or
    somewhere else but with berks instead of chef-client) in a virtualmachine
    provisioned by vagrant ?

So I used opensource chef-server in our localnetwork. And most of all i’am
interested in deploy our and community cookbooks on production virtual
machines (lxc).

May be my questions is not good. May be I need some time to read a
documentation of berks and vagrant. There is no doubt of course.

Why not use only vagrant with defined chef cookbooks ?

Thank youf or help.

the lines below is to forward ports

config.vm.network :forwarded_port, host: 8080, guest: 8080
config.vm.network :forwarded_port, host: 8443, guest: 8443

the line below must be used if you need to sync a local directory with

the remote
config.vm.synced_folder “…/…/”, "/repo"
config.vm.provision :chef_solo do |chef|

the line below is used if you need a proxy

config.proxy.http = "http://web-proxy.corp.hp.com:**8080/http://web-proxy.corp.hp.com:8080/

"

config.proxy.https = "http://web-proxy.corp.hp.com:**8080/http://web-proxy.corp.hp.com:8080/

"

the chef .son you use to pass attributes that you need to rewrite if

you use Vagrant for example.
chef.json = {
}
chef.run_list = [
“recipe[xxxx::default]”,
“recipe[minitest-handler::**default]”
]
end
end

vagrant ssh --> to connect to the provisioned system

The vagrant up, destroy, reload, ssh must be ran at the same directory
that you have Vagrant file

Eduardo


Best regards,

CVision Lab System Administrator
Vladmir Skubriev

Atenciosamente,

Eduardo


#7

Hi Vladimir,

yes, you have to read about the tools and try them out so that you can
decice on your own, but I think you are on the right track and betting on
the tools and best practices which have proven in the community.

Vagrant-berkshelf works both with application cookbooks or normal
cookbooks, it just ensures that the cookbooks defined in the Berksfile
are available for the Chef run in the VM.

Afaik vagrant-berkshelf also works with Chef Server (it will berks upload
the cookbooks before starting the VM). You could also check out chef-zero /
vagrant-chef-zero which is an in-memory Chef Server perfectly suitable for
Cookbook testing.

Also double-check if you really need Chef server or whether Chef solo is
sufficient for your needs. The main arguments for using Chef server is if
you are using search. Databags, environments and roles also work fine with
Chef solo.

For lxc and vagrant you might also want to check out this blog post:

Cheers,
Torben

On Wed, Oct 30, 2013 at 3:19 PM, Eduardo Dias eduardodiasbr@gmail.comwrote:

Look, Berkshelf you use to solve dependencies, Vagrant you use for
chef-solo, and Virtualbox is your virtual machines. Then, what I ma
proposing it to put all working together.

  1. This is for testing cookbooks with chef-solo on workstation? Yes
  2. To upload defined in Berksfile cookbooks(from working machine or
    somewhere else but with berks instead of chef-client) in a virtual machine
    provisioned by vagrant ? Yes
    Why not use only vagrant with defined chef cookbooks ?
    if you use chef-solo you use Vagrant + Virtual Box, if you want to deploy
    in the cloud you need to configure Vagrant file with other config , but
    always Berkshelf will be present.

2013/10/30 Vladimir Skubriev skubriev@cvisionlab.com

30.10.2013 17:05, Eduardo Dias пишет:

You need to download a box (like ubuntu), create a vagrant file, and

vagrant up.
vagrant box add (look at Vagrant to get the corerct url)

Simple Vargrant file:

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.hostname = "<server_name>"
config.vm.box = "<box_name>"
config.berkshelf.enabled = true

To be honest I can not understand: “What is the role of plugin enabled
by config.berkshelf.enabled = true ?”

or

What is the role of berks in virtual machine created by vagrant, with
config defined option config.berkshelf.enabled = true ?

  1. This is for testing cookbooks with chef-solo on workstation?

  2. To upload defined in Berksfile cookbooks(from working machine or
    somewhere else but with berks instead of chef-client) in a virtualmachine
    provisioned by vagrant ?

So I used opensource chef-server in our localnetwork. And most of all
i’am interested in deploy our and community cookbooks on production virtual
machines (lxc).

May be my questions is not good. May be I need some time to read a
documentation of berks and vagrant. There is no doubt of course.

Why not use only vagrant with defined chef cookbooks ?

Thank youf or help.

the lines below is to forward ports

config.vm.network :forwarded_port, host: 8080, guest: 8080
config.vm.network :forwarded_port, host: 8443, guest: 8443

the line below must be used if you need to sync a local directory with

the remote
config.vm.synced_folder “…/…/”, "/repo"
config.vm.provision :chef_solo do |chef|

the line below is used if you need a proxy

config.proxy.http = "http://web-proxy.corp.hp.com:**8080/http://web-proxy.corp.hp.com:8080/

"

config.proxy.https = "http://web-proxy.corp.hp.com:**8080/http://web-proxy.corp.hp.com:8080/

"

the chef .son you use to pass attributes that you need to rewrite if

you use Vagrant for example.
chef.json = {
}
chef.run_list = [
“recipe[xxxx::default]”,
“recipe[minitest-handler::**default]”
]
end
end

vagrant ssh --> to connect to the provisioned system

The vagrant up, destroy, reload, ssh must be ran at the same directory
that you have Vagrant file

Eduardo


Best regards,

CVision Lab System Administrator
Vladmir Skubriev

Atenciosamente,

Eduardo