chef-repo
chef-repo
)mkdir -p chef-repo/.chef mkdir -p chef-repo/cookbooks mkdir -p chef-repo/environments mkdir -p chef-repo/roles
cat Gemfile source 'https://rubygems.org' # get Berkshelf 3.0.beta gem 'chef' gem "berkshelf", github: "berkshelf/berkshelf"
bundle install
cat Berksfile source "https://api.berkshelf.com"
This step is optional if you already have a running remote machine with ssh access.
homenetwork
cookbookknife cookbook create homenetwork
metadata.rb name 'homenetwork' maintainer 'YOUR_NAME' maintainer_email 'YOUR_EMAIL' license 'All rights reserved' description 'Installs/Configures homenetwork' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.6' depends 'dmg' depends 'vagrant' depends 'homebrew'
#testlab include_recipe "homebrew" dmg_package 'Virtualbox' do source 'http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-OSX.dmg' type 'pkg' end node.set.vagrant.url = "https://dl.bintray.com/mitchellh/vagrant/Vagrant-1.4.3.dmg" node.set.vagrant.sha = "e7ff13b01d3766829f3a0c325c1973d15b589fe1a892cf7f857da283a2cbaed1" node.set.vagrant.upgrade include_recipe "vagrant"
add it to the Berksfile
echo “cookbook 'homenetwork', :path => ‘cookbooks/homenetwork’” >> Berksfile
bundle exec berks install
bundle exec berks upload
knife bootstrap --sudo -x <osx-user> <ip-of-osx-box> -r homenetwork::testlab Bootstrapping Chef on <ip-of-osx-box> <ip-of-osx-box> knife sudo password: Enter your password:
echo “cookbook ‘gitlab', git: ‘https://gitlab.com/gitlab-org/cookbook-gitlab.git'” >> Berksfile
bundle exec berks install bundle exec berks upload
{ "name": "gitlab", "description": "", "json_class": "Chef::Role", "default_attributes": { "gitlab": { "host": "gitlab.example.com", "url": "http://gitlab.example.com/", "email_from": “gitlab@example.com", "support_email": “support@example.com", "database_adapter": "postgresql", "database_password": “set me“ }, "postgresql": { "password": { "postgres": “set “me } }, "postfix": { "mail_type": "client", "myhostname": "mail.example.com", "mydomain": "example.com", "myorigin": "mail.example.com", "smtp_use_tls": "no" } }, "override_attributes": { }, "chef_type": "role", "run_list": [ "recipe[postfix]", "recipe[gitlab::default]" ], "env_run_lists": { } }
knife role from file gitlab.json
$ knife bootstrap --sudo -x <user-you-created> <ip-of-gitlab> -r role[gitlab] Bootstrapping Chef on <ip-of-gitlab> <ip-of-gitlab> knife sudo password: Enter your password:
Interested in Cloud or Chef Trainings? Have a look at our Commandemy Trainings page. Need help migrating to the cloud? Check out Infralovers.
comments powered by Disqus