Slide 1

Slide 1 text

Automating your Infrastructure with Chef Beyond the Code - September 2014 Jennifer Davis, Chef Inc 1

Slide 2

Slide 2 text

Communicate. Collaborate. 2 Twitter: @sigje #beyondthecode

Slide 3

Slide 3 text

Introductions 3

Slide 4

Slide 4 text

Twitter: @sigje Email: [email protected] Introductions Name Current Job Role Previous Job Experience Experience with Infrastructure Automation Favorite Text Editor 4

Slide 5

Slide 5 text

5 @beerops @bridgetkromhout

Slide 6

Slide 6 text

6

Slide 7

Slide 7 text

Objectives 7

Slide 8

Slide 8 text

Twitter: @sigje Email: [email protected] Objectives Describe Infrastructure Automation Describe Chef architecture, tools Read Chef Recipes 8

Slide 9

Slide 9 text

Twitter: @sigje Email: [email protected] Application of Learning Knowledge of your environment, business needs Chef - Framework to solve infrastructure automation 9

Slide 10

Slide 10 text

Twitter: @sigje Email: [email protected] Chef Fluency 10 20% 80% Training Practice Fundamentals Training - 16 hours

Slide 11

Slide 11 text

Twitter: @sigje Email: [email protected] Additional Resources 11 Fundamentals Training, Intermediate Training Learn Chef Google Forum

Slide 12

Slide 12 text

Twitter: @sigje Email: [email protected] Workshop Fundamentals Objectives at the beginning. Ask questions. Ask for help. Answer questions. Slides will be available after the class. 12

Slide 13

Slide 13 text

Twitter: @sigje Email: [email protected] Setting Expectations Experience Level: Beginner Flexible content based on class It’s OK to leave (and come back). Minimize disruptions. 13

Slide 14

Slide 14 text

Agenda 14

Slide 15

Slide 15 text

Twitter: @sigje Email: [email protected] Agenda Overview of Infrastructure Automation Intro to Resources, Recipes, Cookbooks Working with the Node Object Introduction to Community Cookbooks 15

Slide 16

Slide 16 text

Overview of Infrastructure Automation 16

Slide 17

Slide 17 text

Twitter: @sigje Email: [email protected] Objectives: Overview of Infrastructure Automation Describe Infrastructure Automation. Describe how Chef treats Infrastructure Automation. Define Node. 17

Slide 18

Slide 18 text

Describe Infrastructure Automation 18

Slide 19

Slide 19 text

What is Infrastructure Automation? 19

Slide 20

Slide 20 text

What is Infrastructure?? 20

Slide 21

Slide 21 text

Twitter: @sigje Email: [email protected] Applications 21 MongoDB Apache Java Drupal WordPress cakephp

Slide 22

Slide 22 text

Twitter: @sigje Email: [email protected] Complexity in Applications 22 Single service == multiple applications. Single application == a component of service.

Slide 23

Slide 23 text

Twitter: @sigje Email: [email protected] Configurations 23 Operating Systems. Software. Network. Storage.

Slide 24

Slide 24 text

Twitter: @sigje Email: [email protected] Complexity in Configurations 24 Multiple services using same software with different configurations. Different Operating Systems requiring same software (and user experience).

Slide 25

Slide 25 text

Twitter: @sigje Email: [email protected] Access Control 25 Users. Groups. Organizations.

Slide 26

Slide 26 text

Twitter: @sigje Email: [email protected] Complexity in Access Control 26 Different users access to different systems. External versus internal. Compliance.

Slide 27

Slide 27 text

Twitter: @sigje Email: [email protected] Data 27 Tweets. Profiles. Emails. Specific to your organization.

Slide 28

Slide 28 text

Twitter: @sigje Email: [email protected] Servers 28 physical hardware cloud services AWS Digital Ocean virtual VMWare OpenStack VirtualBox

Slide 29

Slide 29 text

Twitter: @sigje Email: [email protected] Complexity in Servers 29 Specialization in hardware. Lack of standardization.

Slide 30

Slide 30 text

Twitter: @sigje Email: [email protected] Network 30 routers switches firewalls

Slide 31

Slide 31 text

Twitter: @sigje Email: [email protected] Storage 31 tape libraries NAS/SAN attached storage

Slide 32

Slide 32 text

Twitter: @sigje Email: [email protected] People 32

Slide 33

Slide 33 text

What is Automation? 33

Slide 34

Slide 34 text

Twitter: @sigje Email: [email protected] Automation 34 automaton acting of one’s own will Antikythera mechanism 150-100BC calculate positions of astronomical objects "NAMA Machine d'Anticythère 1". Licensed under Creative Commons Attribution 2.5 via Wikimedia Commons - http://commons.wikimedia.org/wiki/

Slide 35

Slide 35 text

Twitter: @sigje Email: [email protected] Automation 35 reduce labor, energy, and materials improve quality, precision, accuracy

Slide 36

Slide 36 text

What is Infrastructure Automation? 36

Slide 37

Slide 37 text

Infrastructure Automation is creating control systems that reduce the burden on people to manage services and increase the quality, accuracy and precision of a service to the consumers of the service. 37

Slide 38

Slide 38 text

Describe how Chef treats Infrastructure Automation. 38

Slide 39

Slide 39 text

Twitter: @sigje Email: [email protected] Infrastructure as Code 39 Programmatically provision and configure components.

Slide 40

Slide 40 text

Twitter: @sigje Email: [email protected] Infrastructure as Code 40 Treat infrastructure code like the rest of the code.

Slide 41

Slide 41 text

Twitter: @sigje Email: [email protected] Infrastructure as Code 41 Reconstruct business from code repository, data backups, and compute resources.

Slide 42

Slide 42 text

Twitter: @sigje Email: [email protected] Chef Tenets of Infrastructure as Code 42 1. Programmatically provision and configure components. 2. Treat infrastructure code like the rest of the code. 3. Reconstruct business from code repository, data backups, and compute resources.

Slide 43

Slide 43 text

Define a Node 43

Slide 44

Slide 44 text

Twitter: @sigje Email: [email protected] Nodes 44 any physical, virtual, or cloud machine that is configured to be maintained by a chef-client.

Slide 45

Slide 45 text

Twitter: @sigje Email: [email protected] Physical Node 45 server virtual machine any active device attached to a network that can run a chef-client.

Slide 46

Slide 46 text

Twitter: @sigje Email: [email protected] Network Node 46 any active network device attached to a network that can run a chef-client.

Slide 47

Slide 47 text

Twitter: @sigje Email: [email protected] Cloud Node 47 Amazon Virtual Private Cloud OpenStack Rackspace Google Compute Engine Linode Microsoft Azure

Slide 48

Slide 48 text

Twitter: @sigje Email: [email protected] Virtual Node 48 a machine that runs only as a software implementation, but otherwise behaves much like a physical machine.

Slide 49

Slide 49 text

Twitter: @sigje Email: [email protected] Containers 49 a single operating system to host many working configurations, with each working configuration running as a process that is isolated from all other processes, including even the host operating system

Slide 50

Slide 50 text

Twitter: @sigje Email: [email protected] chef-client 50 agent - special software installed on the server

Slide 51

Slide 51 text

Twitter: @sigje Email: [email protected] hostname vs node name 51 host name - network addressable label assigned to a server node name - unique identifier RECOMMENDATION: hostname == node name

Slide 52

Slide 52 text

Twitter: @sigje Email: [email protected] Lesson 1: Set up your cloud node http://opscode- cheflab.herokuapp.com/labs/ chefdk/centos/attend/ Fill in the form! 52

Slide 53

Slide 53 text

Twitter: @sigje Email: [email protected] Lesson 1: Set up your cloud node http://opscode- cheflab.herokuapp.com/labs/ chefdk/centos/attend/ Click on “Create user” 53

Slide 54

Slide 54 text

Twitter: @sigje Email: [email protected] Lesson 1: Set up your cloud node ! Wait until you see “Environment is Ready” Click on “Start Using This Environment” 54

Slide 55

Slide 55 text

Twitter: @sigje Email: [email protected] Lesson 1: Set up your cloud node 55 ! SUCCESS! Server has been created.

Slide 56

Slide 56 text

Twitter: @sigje Email: [email protected] Lesson 2: Identify your cloud node ! Click on “More details” 56

Slide 57

Slide 57 text

Twitter: @sigje Email: [email protected] Lesson 2: Identify your cloud node ! External Address Host Name 57

Slide 58

Slide 58 text

Twitter: @sigje Email: [email protected] Lesson 2: Identify your cloud node ! Click on “show password” 58

Slide 59

Slide 59 text

Twitter: @sigje Email: [email protected] Lesson 2: Identify your cloud node ! Click on “show password” Password will be in the clear. Note it down. 59

Slide 60

Slide 60 text

Twitter: @sigje Email: [email protected] Lesson 3: Connect to your cloud node ! 2 choices. ssh available? GUI (may be a little slower) 60

Slide 61

Slide 61 text

Twitter: @sigje Email: [email protected] Lesson 3: Connect to your cloud node with SSH ! Remember this is YOUR hostname Remember this is YOUR root password ssh $HOSTNAME -l root 61

Slide 62

Slide 62 text

Twitter: @sigje Email: [email protected] Lesson 3: Connect to your cloud node with SSH ! at command prompt type cd chef-repo 62

Slide 63

Slide 63 text

Twitter: @sigje Email: [email protected] Lesson 3: Connect to your cloud node with GUI ! Click on “View VM” 63

Slide 64

Slide 64 text

Twitter: @sigje Email: [email protected] Lesson 3: Connect to your cloud node with GUI ! Click anywhere in the white box. 64

Slide 65

Slide 65 text

Twitter: @sigje Email: [email protected] Lesson 4: Verify chef-dk install ! At command prompt type chef verify 65

Slide 66

Slide 66 text

Twitter: @sigje Email: [email protected] Chef Development Kit chef Berkshelf 3.0 Test Kitchen ChefSpec Foodcritic chef-client knife ohai Chef Zero 66

Slide 67

Slide 67 text

Twitter: @sigje Email: [email protected] chef command-line tool 67

Slide 68

Slide 68 text

Twitter: @sigje Email: [email protected] Verify Installation $ chef verify verifies that all applications are installed as appropriate 68

Slide 69

Slide 69 text

Intro to Resources, Recipes, Cookbooks 69

Slide 70

Slide 70 text

Twitter: @sigje Email: [email protected] Objectives: Intro to Resources, Recipes, Cookbooks Define resources. Explain what a recipe is. Define cookbooks. 70

Slide 71

Slide 71 text

What is a Resource? 71

Slide 72

Slide 72 text

Twitter: @sigje Email: [email protected] Question: What is Infrastructure? 72

Slide 73

Slide 73 text

Twitter: @sigje Email: [email protected] Answer: What is Infrastructure? application configuration access control data servers people 73

Slide 74

Slide 74 text

Twitter: @sigje Email: [email protected] Infrastructure Elements the individual components or building blocks we have access to automate. 74

Slide 75

Slide 75 text

Twitter: @sigje Email: [email protected] Infrastructure Elements files directories symlinks mounts users groups software packages external services filesystems 75

Slide 76

Slide 76 text

A resource represents an element or component of the system. 76

Slide 77

Slide 77 text

Twitter: @sigje Email: [email protected] Resources Examples directory env execute file git 77

Slide 78

Slide 78 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources Open up a browser window to http://docs.getchef.com/ 78

Slide 79

Slide 79 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources Click on “Search the Docs” 79

Slide 80

Slide 80 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources Click on “Search the Docs” 80

Slide 81

Slide 81 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources enter the word resources into the search box 81

Slide 82

Slide 82 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources click on “Resources and Providers Reference - Chef Single-page Topics” 82

Slide 83

Slide 83 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources Scroll down the “Table of Contents” on the right hand side Find and click on “Resources” 83

Slide 84

Slide 84 text

Twitter: @sigje Email: [email protected] Lesson 5: Use docs to find info about resources Success! 84

Slide 85

Slide 85 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. GUI users: if the node isn’t available, click on “Reconnect” 85

Slide 86

Slide 86 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. SSH users vi hello.rb GUI vi hello.rb or gedit hello.rb & 86

Slide 87

Slide 87 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. GUI gedit users Opens a graphical window Click on the window to type in it. 87

Slide 88

Slide 88 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. 88

Slide 89

Slide 89 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. 89

Slide 90

Slide 90 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. GUI gedit users Click on “File” 90

Slide 91

Slide 91 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. GUI gedit users Click on “Save” 91

Slide 92

Slide 92 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. SSH and GUI - vi users type “i” to go into insert mode enter text 92

Slide 93

Slide 93 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. vi users Click “esc” key (Command mode) Enter “:x” and click return 93

Slide 94

Slide 94 text

Twitter: @sigje Email: [email protected] Lesson 6: Create a file resource. create a file named hello.rb. add content. save the file. 94

Slide 95

Slide 95 text

Twitter: @sigje Email: [email protected] Lesson 7: Apply the resource. At command prompt type: chef-apply hello.rb 95

Slide 96

Slide 96 text

Twitter: @sigje Email: [email protected] Lesson 8: Verify that the file was created. At command prompt type: cat motd 96

Slide 97

Slide 97 text

Twitter: @sigje Email: [email protected] Lesson 9: Update the resource. At command prompt type: chef-apply hello.rb 97

Slide 98

Slide 98 text

Twitter: @sigje Email: [email protected] Lesson 10: Modify the resource. Edit your resource to make your message personal! Edit the file. Modify ‘hello world’. 98

Slide 99

Slide 99 text

Twitter: @sigje Email: [email protected] Lesson 11: Update the resource. At command prompt type: chef-apply hello.rb 99

Slide 100

Slide 100 text

Twitter: @sigje Email: [email protected] Lesson 11: Update the resource. At command prompt type: chef-apply hello.rb 100

Slide 101

Slide 101 text

Twitter: @sigje Email: [email protected] Lesson 12: Verify the file changed. At command prompt type: cat motd 101

Slide 102

Slide 102 text

Twitter: @sigje Email: [email protected] Lesson 13: Modify the file by hand. Edit the motd file to have a new message. 102

Slide 103

Slide 103 text

Twitter: @sigje Email: [email protected] Lesson 14: Update the resource. 103 At command prompt type: chef-apply hello.rb

Slide 104

Slide 104 text

Twitter: @sigje Email: [email protected] Lesson 14: Update the resource. 104 At command prompt type: chef-apply hello.rb

Slide 105

Slide 105 text

We programmatically defined a file resource. 105

Slide 106

Slide 106 text

Twitter: @sigje Email: [email protected] Lesson 15: Delete a file resource. create a file named goodbye.rb. add content. file ‘motd’ do action :delete end save file. 106

Slide 107

Slide 107 text

Twitter: @sigje Email: [email protected] Lesson 15: Apply the resource. 107 At command prompt type: ?????

Slide 108

Slide 108 text

Twitter: @sigje Email: [email protected] Lesson 15: Apply the resource. 108 At command prompt type: chef-apply goodbye.rb

Slide 109

Slide 109 text

Twitter: @sigje Email: [email protected] Lesson 15: Apply the resource. 109 At command prompt type: chef-apply goodbye.rb

Slide 110

Slide 110 text

Twitter: @sigje Email: [email protected] Lesson 16: Verify the file was deleted. 110 At command prompt type: cat motd

Slide 111

Slide 111 text

A resource represents an element or component of the system. A resource describes what the element should be not how to achieve that state of being. 111

Slide 112

Slide 112 text

Twitter: @sigje Email: [email protected] Review Created hello.rb and goodbye.rb Created file resource. Ran chef commands to create and update resource. 112

Slide 113

Slide 113 text

Twitter: @sigje Email: [email protected] Review 113 File Resource File Resource We created a File resource.

Slide 114

Slide 114 text

Twitter: @sigje Email: [email protected] There are a number of different resources that are defined in the documentation. package "apache2" Review 114 Package Resource

Slide 115

Slide 115 text

Twitter: @sigje Email: [email protected] There are a number of different resources that are defined in the documentation. Review 115 Template Resource template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode "0644" variables(:allow_override => "All") notifies :reload, "service[apache2]" end

Slide 116

Slide 116 text

Twitter: @sigje Email: [email protected] There are a number of different resources that are defined in the documentation. Review 116 service "apache2" do action [:enable,:start] supports :reload => true end Service Resource

Slide 117

Slide 117 text

Twitter: @sigje Email: [email protected] Review 117 RECIPE RECIPE We created two recipes.

Slide 118

Slide 118 text

What is a Recipe? 118

Slide 119

Slide 119 text

A recipe is a file that describes resources and their desired state. 119

Slide 120

Slide 120 text

Twitter: @sigje Email: [email protected] Review 120 RECIPE RECIPE We created a hello recipe and a goodbye recipe.

Slide 121

Slide 121 text

Twitter: @sigje Email: [email protected] hello recipe should contain all the resources required to create motd. Review 121

Slide 122

Slide 122 text

Twitter: @sigje Email: [email protected] goodbye recipe should contain all the resources required to clean up any resources we created for hello. Review 122

Slide 123

Slide 123 text

Twitter: @sigje Email: [email protected] Lesson 17: Create a webserver recipe. 123 ????

Slide 124

Slide 124 text

Twitter: @sigje Email: [email protected] Lesson 17: Create a webserver recipe. create a file named webserver.rb. add content. save file. 124

Slide 125

Slide 125 text

Twitter: @sigje Email: [email protected] Lesson 17: Create a webserver recipe. create a file named webserver.rb. add content. package resource install apache server save file. 125 package 'httpd'

Slide 126

Slide 126 text

Twitter: @sigje Email: [email protected] Lesson 18: Apply the resource. ????? 126

Slide 127

Slide 127 text

Twitter: @sigje Email: [email protected] Lesson 18: Apply the resource. 127 At command prompt type: chef-apply webserver.rb

Slide 128

Slide 128 text

Twitter: @sigje Email: [email protected] Lesson 18: Apply the resource. 128 At command prompt type: chef-apply webserver.rb

Slide 129

Slide 129 text

Twitter: @sigje Email: [email protected] Lesson 19: Re-run chef-apply. 129 At command prompt type: chef-apply webserver.rb

Slide 130

Slide 130 text

Twitter: @sigje Email: [email protected] Lesson 20: Modify recipe to start Apache. edit webserver.rb. add content. service resource starts and enables httpd service save file. 130 package ‘httpd’ ! service 'httpd' do action [:start, :enable] end

Slide 131

Slide 131 text

Twitter: @sigje Email: [email protected] Lesson 21: Apply the resource. ????? 131

Slide 132

Slide 132 text

Twitter: @sigje Email: [email protected] Lesson 21: Apply the resource. 132 At command prompt type: chef-apply webserver.rb

Slide 133

Slide 133 text

Twitter: @sigje Email: [email protected] Review 133 We created a web server recipe to install, start, and enable Apache on boot.

Slide 134

Slide 134 text

Twitter: @sigje Email: [email protected] Lesson 22: Verify webserver running. Open a browser. 134 Click on the Firefox Icon to open the browser.

Slide 135

Slide 135 text

Twitter: @sigje Email: [email protected] Lesson 22: Verify webserver running. Open a browser. localhost in the URL field. 135 localhost

Slide 136

Slide 136 text

Twitter: @sigje Email: [email protected] Lesson 23: Modify recipe to add index.html. edit webserver.rb. add content. service file save file. 136 file '/var/www/html/index.html' do content '

hello world

' end

Slide 137

Slide 137 text

Twitter: @sigje Email: [email protected] Lesson 24: Apply the resource. ????? 137

Slide 138

Slide 138 text

Twitter: @sigje Email: [email protected] Lesson 24: Apply the resource. 138 At command prompt type: chef-apply webserver.rb

Slide 139

Slide 139 text

Twitter: @sigje Email: [email protected] Lesson 25: Reload webpage. Open a browser. Shift + Click on reload. 139 Shift +Click

Slide 140

Slide 140 text

Twitter: @sigje Email: [email protected] Review 140 We created a personalized index.html. HTML code is embedded in the recipe, our infrastructure code.

Slide 141

Slide 141 text

How do we separate our web page code from infrastructure code? 141

Slide 142

Slide 142 text

Twitter: @sigje Email: [email protected] Lesson 26: Create a working directory. 142 At command prompt type: mkdir cookbooks cd cookbooks

Slide 143

Slide 143 text

What is a Cookbook? 143

Slide 144

Slide 144 text

A cookbook is a collection of recipes. 144

Slide 145

Slide 145 text

Twitter: @sigje Email: [email protected] Lesson 27: Create a webserver cookbook. 145 At command prompt type: chef generate cookbook webserver

Slide 146

Slide 146 text

Twitter: @sigje Email: [email protected] Lesson 28: Examine cookbook. 146 At command prompt type: tree

Slide 147

Slide 147 text

Twitter: @sigje Email: [email protected] Lesson 29: Create template file. 147 At command prompt type: chef generate template webserver index.html

Slide 148

Slide 148 text

Twitter: @sigje Email: [email protected] Lesson 28: Examine cookbook. 148 At command prompt type: tree

Slide 149

Slide 149 text

Twitter: @sigje Email: [email protected] Lesson 29: Edit index.html.erb file. 149 edit index.html.erb EDITOR webserver/templates/default/ index.html.erb add content. save file.

hello world

Slide 150

Slide 150 text

Twitter: @sigje Email: [email protected] Lesson 30: Edit default recipe. 150 edit default.rb EDITOR webserver/recipes/default.rb add content. package, service, template resources save file. package 'httpd' ! service 'httpd' do action [:start, :enable] end ! template '/var/www/html/index.html' do source 'index.html.erb' end

Slide 151

Slide 151 text

Twitter: @sigje Email: [email protected] Lesson 30: Edit default recipe. 151 edit default.rb EDITOR webserver/recipes/default.rb add content. package, service, template resources save file. package 'httpd' ! service 'httpd' do action [:start, :enable] end ! template '/var/www/html/index.html' do source 'index.html.erb' end

Slide 152

Slide 152 text

What is a Cookbook? 152

Slide 153

Slide 153 text

A cookbook is a collection of recipes, templates, custom resources, files, .… 153

Slide 154

Slide 154 text

Twitter: @sigje Email: [email protected] Lesson 31: Use our cookbook. 154 At command prompt type: chef-client --local-mode --runlist webserver

Slide 155

Slide 155 text

Twitter: @sigje Email: [email protected] Lesson 32: Reload webpage. Open a browser. Shift + Click on reload. 155 Shift +Click

Slide 156

Slide 156 text

Twitter: @sigje Email: [email protected] Review 156 separation of our web code and infrastructure code.

Slide 157

Slide 157 text

Twitter: @sigje Email: [email protected] Review 157 chef-apply - single recipe chef-client - multiple recipes local-mode — not using chef server runlist — specify the ordered set of recipes to run.

Slide 158

Slide 158 text

Twitter: @sigje Email: [email protected] Standard Chef Workflow 158

Slide 159

Slide 159 text

Working with the Node Object 159

Slide 160

Slide 160 text

Twitter: @sigje Email: [email protected] Objectives: Working with the Node Object Explain what the node object is in Chef. Show details about a node. Describe node attributes. 160

Slide 161

Slide 161 text

Twitter: @sigje Email: [email protected] Node Object 161 A node is any physical, virtual, or cloud machine that is configured to be maintained by a chef-client. The node object is representation of that node within chef (e.g. in JSON). Available when you are writing recipes.

Slide 162

Slide 162 text

Twitter: @sigje Email: [email protected] Lesson 33: Set PATH variable. 162 At command prompt type: export PATH=$PATH:/opt/chef/embedded/bin:/opt/chefdk/embedded/bin

Slide 163

Slide 163 text

Twitter: @sigje Email: [email protected] Lesson 34: Run Ohai 163 At command prompt type: ohai To page through the output: ohai | less

Slide 164

Slide 164 text

Twitter: @sigje Email: [email protected] Node Attributes 164 Ohai populates automatically discovered attributes of the node.

Slide 165

Slide 165 text

Twitter: @sigje Email: [email protected] Node Attributes 165 Ability to programmatically add additional attributes in recipes and cookbooks node.default["apache"]["dir"] = "/etc/apache2" attribute name attribute value

Slide 166

Slide 166 text

Twitter: @sigje Email: [email protected] Lesson 35: Create the attribute file. At command prompt type: chef generate attribute webserver default 166

Slide 167

Slide 167 text

Twitter: @sigje Email: [email protected] Lesson 36: Examine cookbook. 167 At command prompt type: tree

Slide 168

Slide 168 text

Twitter: @sigje Email: [email protected] Lesson 37: Edit the attribute file. 168 edit default.rb EDITOR webserver/attributes/default.rb add content. save file. default["apache"]["indexfile"] = "index.html"

Slide 169

Slide 169 text

Intro to Community Cookbooks 169

Slide 170

Slide 170 text

Twitter: @sigje Email: [email protected] Objectives: Intro to Community Cookbooks Find, preview, download cookbooks from the community. Use knife to work with the Supermarket API. Download, extract, examine, and implement cookbooks from the Supermarket. 170

Slide 171

Slide 171 text

Twitter: @sigje Email: [email protected] Chef 171 Company Open Source Software Command Line tool Community

Slide 172

Slide 172 text

Welcome to the Chef Community! 172

Slide 173

Slide 173 text

Twitter: @sigje Email: [email protected] Supermarket tools and cookbooks created and shared by the community 173

Slide 174

Slide 174 text

Twitter: @sigje Email: [email protected] Lesson 38: Browse the Supermarket website. Open a browser. supermarket.getchef.com 174

Slide 175

Slide 175 text

Twitter: @sigje Email: [email protected] Lesson 38: Browse the Supermarket website. type “apache” in the search box. 175

Slide 176

Slide 176 text

Twitter: @sigje Email: [email protected] Lesson 38: Browse the Supermarket website. Many Cookbooks! 176

Slide 177

Slide 177 text

Twitter: @sigje Email: [email protected] Lesson 39: Inspect the apache cookbook. Click on “apache” 177

Slide 178

Slide 178 text

Twitter: @sigje Email: [email protected] Lesson 39: Inspect the apache cookbook. 178 Maintainer

Slide 179

Slide 179 text

Twitter: @sigje Email: [email protected] Lesson 39: Inspect the apache cookbook. 179 Source

Slide 180

Slide 180 text

Twitter: @sigje Email: [email protected] Lesson 39: Inspect the apache cookbook. 180 Recent Activity

Slide 181

Slide 181 text

Twitter: @sigje Email: [email protected] Lesson 40: Search Supermarket from command line 181 At command prompt type: knife cookbook site search chef-client

Slide 182

Slide 182 text

Twitter: @sigje Email: [email protected] Lesson 40: Search Supermarket from command line 182 At command prompt type: knife cookbook site show chef-client

Slide 183

Slide 183 text

Twitter: @sigje Email: [email protected] Lesson 40: Search Supermarket from command line 183 At command prompt type: knife cookbook site show chef-client

Slide 184

Slide 184 text

Twitter: @sigje Email: [email protected] Lesson 41: Download chef-client cookbook. 184 At command prompt type: knife cookbook site download chef-client

Slide 185

Slide 185 text

Twitter: @sigje Email: [email protected] Review 185 Searched Supermarket site for a cookbook. Downloaded cookbook.

Slide 186

Slide 186 text

Twitter: @sigje Email: [email protected] Review 186 Downloaded cookbook. Code. Root. Examine before using.

Slide 187

Slide 187 text

Twitter: @sigje Email: [email protected] Lesson 42: Extract chef-client cookbook. 187 At command prompt type: tar zxvf chef-client-3.8.0.tar.gz

Slide 188

Slide 188 text

Twitter: @sigje Email: [email protected] Lesson 42: Read the chef-client cookbook. 188 Examine the README.md cat chef-client/README.md

Slide 189

Slide 189 text

Twitter: @sigje Email: [email protected] Lesson 42: Read the chef-client cookbook. 189 Examine the README.md Expectations of the cookbook, platform, data Recipes Usage Notes

Slide 190

Slide 190 text

Twitter: @sigje Email: [email protected] Lesson 43: Use the chef-client cookbook. 190 At command prompt type: chef-client --local-mode --runlist webserver,chef-client This will fail because we haven’t set up an org in hosted chef.

Slide 191

Slide 191 text

Conclusion 191

Slide 192

Slide 192 text

Twitter: @sigje Email: [email protected] Review Overview of Infrastructure Automation Intro to Resources, Recipes, Cookbooks Working with the Node Object Introduction to Community Cookbooks 192

Slide 193

Slide 193 text

Twitter: @sigje Email: [email protected] Objectives Describe Infrastructure Automation Describe Chef architecture, tools Read Chef Recipes 193

Slide 194

Slide 194 text

Twitter: @sigje Email: [email protected] Resources: O’Reilly Books Learning Chef - Mischa Taylor and Seth Vargo Experience Level: Beginner to Chef Customizing Chef - Jon Cowie Experience Level: Intermediate to Chef Sekret code: (ONLY AVAILABLE TO ATTENDEES) 50% print discount, 40% ebook discount 194

Slide 195

Slide 195 text

Twitter: @sigje Email: [email protected] Additional Resources 195 Fundamentals Training, Intermediate Training Learn Chef Fundamentals videos Google Forum Sign up for Virtual Office Hours

Slide 196

Slide 196 text

Twitter: @sigje Email: [email protected] THANK YOU Shirts Knife Reference Guides Give me your business card (or email me contact details) and I’ll send you DRAFT version of Learning Chef ebook (potential spelling mistakes..) 196

Slide 197

Slide 197 text

Communicate. Collaborate. 197 Twitter: @sigje #beyondthecode Email: [email protected]