Primeiros Passos com Chef

  • 281 views
Uploaded on

Um workshop para quem está começando com a ferramenta Opscode Chef. …

Um workshop para quem está começando com a ferramenta Opscode Chef.
Apresentado no Idéias em Produção, em 21 de Abril de 2013 no escritório da ThoughtWorks Brasil em Porto Alegre.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
281
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. primeiros passoscom CHEF@cassianolealSunday, April 21, 13
  • 2. ?CHEFMas afinal,o que éSunday, April 21, 13
  • 3. Sunday, April 21, 13
  • 4. Sunday, April 21, 13
  • 5. RUBYinSunday, April 21, 13
  • 6. knifeé a ferramenta de linhade comando do Chefworkstationna suaSunday, April 21, 13
  • 7. workstationsetupGitVagrantVirtualBoxRubyChefSunday, April 21, 13
  • 8. $ vagrant box add opscode-ubuntu1204 http://<ip>:8000/opscode_ub1204.boxDownloading or copying the box...Extracting box...te: 280M/s, Estimated time remaining: 0:00:01)Successfully added box opscode-ubuntu1204 with providervirtualbox!Sunday, April 21, 13
  • 9. REPOChefgit clone git://github.com/opscode/chef-repocertificates/.chef/config/cookbooks/data_bags/environments/roles/Sunday, April 21, 13
  • 10. knife.rb.chef/current_path = File.expand_path(File.dirname(__FILE__))cookbook_path [ "#{current_path}/../cookbooks" ]Sunday, April 21, 13
  • 11. $ knife cookbook create my_app$ cd cookbooks/my_app$ lsSunday, April 21, 13
  • 12. COOKBOOKmy_appCHANGELOG.mdREADME.mdattributes/definitions/files/libraries/metadata.rbproviders/recipes/resources/templates/Sunday, April 21, 13
  • 13. COOKBOOKmy_appCHANGELOG.mdREADME.mdattributes/definitions/files/libraries/metadata.rbproviders/recipes/resources/templates/Sunday, April 21, 13
  • 14. default.rbrecipes/package ‘apache2’directory “/var/www/my_app” doowner ‘www-data’group ‘www-data’mode 0755action :createendSunday, April 21, 13
  • 15. $ vagrant init opscode_ubuntu1204Sunday, April 21, 13
  • 16. VagrantfileVagrant.configure("2") do |config|config.vm.box = "opscode_ubuntu1204"config.vm.provision :chef_solo do |chef|chef.cookbooks_path = "../../cookbooks"chef.add_recipe "my_app::default"endendSunday, April 21, 13
  • 17. $ vagrant up(...)======================================================Error executing action `install` on resource package[apache2]======================================================Chef::Exceptions::Exec----------------------apt-get -q -y install apache2=2.2.22-1ubuntu1.2 returned 100, expected 0(...)Sunday, April 21, 13
  • 18. $ vagrant ssh$ sudo apt-get -q -y install apache2=2.2.22-1ubuntu1.2Sunday, April 21, 13
  • 19. execute "update apt cache" docommand "apt-get update"user rootaction :runendSunday, April 21, 13
  • 20. SERVERChefhttps://community.opscode.com/users/newSunday, April 21, 13
  • 21. [your_organization_name]-validator.pem[your_username].pemknife.rbREPOChefgit clone git://github.com/opscode/chef-repo$ knife client listSunday, April 21, 13
  • 22. http://community.opscode.com/cookbooks/COMMUNITYwebsiteSunday, April 21, 13
  • 23. $ knife cookbook site install apache2$ git status# On branch master# Your branch is ahead of origin/master by 1 commit.# (use "git push" to publish your local commits)## Untracked files:# (use "git add <file>..." to include in what will be committed)## .chef/nothing added to commit but untracked files present (use "git add" to track)Sunday, April 21, 13
  • 24. GITlogSunday, April 21, 13
  • 25. berkshelfBUNDLERpara cookbooks$ gem install berkshelfSunday, April 21, 13
  • 26. Berksfilesite :opscodecookbook aptcookbook apache2$ berks install$ berks uploadSunday, April 21, 13
  • 27. $ knife cookbook create my_appSunday, April 21, 13
  • 28. default.rbrecipes/directory “#{node[:my_app][:root]}/my_app” doowner node[:apache][:user]group node[:apache][:group]mode 0755action :createendSunday, April 21, 13
  • 29. chef-repo/roles/my_app.rbname my_appdescription A single application serverrun_list(recipe[apt::default],recipe[apache2::default],recipe[my_app])Sunday, April 21, 13
  • 30. $ knife cookbook upload my_app$ knife role from file roles/my_app.rb$ knife cookbook list$ knife role list$ knife role show my_appSunday, April 21, 13
  • 31. TemplatesNode AttributesSearchBootstrapService / Notifies2 caminhos:- alguém sugere o que fazer- seguir o learnchef EC2LWRPSunday, April 21, 13
  • 32. https://learnchef.opscode.comhttp://docs.opscode.comhttp://community.opscode.comhttps://manage.opscode.comhttp://lists.opscode.com/sympairc.freenode.com #chefeagora?Sunday, April 21, 13