-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1762 lines (1287 loc) · 84.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>The Sheinburger</title>
<meta name="author" content="Mike Sheinberg">
<meta name="description" content="So here are some chef notes. I watched some videos, read some documentation and
then I wrote some notes. I should probably find a new hobby. The …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://msheiny.github.io">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="The Sheinburger" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Gloria+Hallelujah' rel='stylesheet' type='text/css'>
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">The Sheinburger</a></h1>
<h2>Self-serving content since 2014</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:msheiny.github.io" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/05/19/okay-more-chef-notes/">Chef Recipes Expanded</a></h1>
<p class="meta">
<time datetime="2014-05-19T18:19:18-04:00" pubdate data-updated="true">May 19<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p><img class="center" src="/images/chef_on_fire.jpg"></p>
<p>So here are some chef notes. I watched some videos, read some documentation and
then I wrote some notes. I should probably find a new hobby.</p>
<h1>The Chef-client run process</h1>
<p>This <a href="http://docs.opscode.com/essentials_nodes_chef_run.html">page</a> provides a good starting point and diagram. I extracted the high-level steps as follows:</p>
<ol>
<li><em>Get configuration data</em> – Node gets process configuration data from it’s own <code>client.rb</code> and from <code>ohai</code></li>
<li><em>authentication</em> – client authenticates to the chef server using RSA keys and node name. On first run, the chef-validator will be used to generate the RSA private key.</li>
<li><em>get, rebuild node object</em> – client pulls down node object from server and rebuilds it.</li>
<li><em>expand the run-list</em> – chef client expands the full run-list from the latest node object that should be applied and in what order.</li>
<li><em>sync cookbooks</em> – asks the chef for required cookbook files and pulls down any changed and new files (compared to whats in cache from last run)</li>
<li><em>Reset node attributes</em> – attributes in rebuilt node object are reset and refilled with attributes from files, environments, roles, and <code>ohai</code>.</li>
<li><em>Compile resource collection</em> – determine all resources that will be needed to process the run-list</li>
<li><em>Converge the node</em> – client configures the system based on info collected</li>
<li><em>Update the node object, process exception and report handlers</em> – client updates node object on server and will go through any exception and report handling as necessary.</li>
</ol>
<h1>Authentication and Authorization</h1>
<p>Communication done via Chef Server API via REST. The server requires authentication via public keys. Public keys stored on chef server, private keys on nodes. The <code>chef-client</code> and <code>knife</code> tools all use the Chef Server API and will sign a special group of HTTP headers with the private key.</p>
<p>During the first <code>chef-client</code> run, there is no private key so the chef-client will try the private key assigned to the chef-validator. Assuming that goes successfully, the chef-client will obtain a <code>client.pem</code> private key for future authentication.</p>
<p>The chef-client authentication workflow:</p>
<ol>
<li>Look in <code>/etc/chef/client.pem</code> for a node private key</li>
<li>If that doesn’t work, check the validator in <code>/etc/chef/validation.pem</code></li>
</ol>
<p>During an initial knife bootstrap, knife will copy the validation pem over to the node to do an initial chef-client run.</p>
<h1>Compile and Execute</h1>
<p>This stage iterating through our run list resources, collecting that into a list, and then iterating over that on the client to determine next action. Chef client will compare to see if the resource is in the appropriate state. If it is already there, no action is taken. Otherwise, the client will work to put it in the desired state.</p>
<h1>Node Object</h1>
<ul>
<li>Any machine configured to be maintained by Chef</li>
<li>Node object is always available to you from within a recipe</li>
<li><p>Each node must have a unique name within an organization. Chef defaults to the FQDN.</p></li>
<li><p>Nodes are made up of attributes</p>
<ul>
<li>Many are discovered automatically (<code>ohai</code>)</li>
<li>Other objects in Chef can add Node attributes (cookbooks, roles/environments, recipes, attribute files)</li>
<li>Nodes are stored and indexed on the Chef server</li>
</ul>
</li>
</ul>
<p>You can quickly get various attribute data from your node through <code>knife</code> or <code>ohai</code></p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># From the chef node directly</span>
</span><span class='line'><span class="nv">$ </span>sudo ohai
</span><span class='line'>
</span><span class='line'><span class="c"># Or from the knife output</span>
</span><span class='line'><span class="nv">$ </span>knife node list chefclient -l
</span><span class='line'>
</span><span class='line'><span class="c"># You can modify formatting options </span>
</span><span class='line'><span class="c"># $ knife node list {clientname} -F{format}</span>
</span><span class='line'><span class="nv">$ </span>knife node list chefclient -Fj
</span><span class='line'><span class="o">{</span>
</span><span class='line'> <span class="s2">"name"</span>: <span class="s2">"chefclient"</span>,
</span><span class='line'> <span class="s2">"chef_environment"</span>: <span class="s2">"_default"</span>,
</span><span class='line'> <span class="s2">"run_list"</span>: <span class="o">[</span>
</span><span class='line'> <span class="s2">"recipe[apt]"</span>,
</span><span class='line'> <span class="s2">"recipe[apache_tutorial]"</span>
</span><span class='line'> <span class="o">]</span>,
</span><span class='line'> <span class="s2">"normal"</span>: <span class="o">{</span>
</span><span class='line'> <span class="s2">"tags"</span>: <span class="o">[</span>
</span><span class='line'> <span class="o">]</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'><span class="o">}</span>
</span><span class='line'>
</span><span class='line'><span class="c"># List a specific attribute with -a</span>
</span><span class='line'><span class="c"># $ knife node list clientname -a {attribute}</span>
</span><span class='line'><span class="nv">$ </span>knife node list chefclient -a platform_version
</span><span class='line'>chefclient:
</span><span class='line'> platform_version: 12.04
</span></code></pre></td></tr></table></div></figure>
<p>Knife searches are based on Apache Solr and are in the format:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>key:search_pattern
</span></code></pre></td></tr></table></div></figure>
<ul>
<li>Key = field name found</li>
<li>search pattern = what will be searched for</li>
</ul>
<p>Examples:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># Wildcard over everything</span>
</span><span class='line'>knife search node <span class="s1">'*:*'</span>
</span><span class='line'>
</span><span class='line'><span class="c"># Search for node running ubuntu</span>
</span><span class='line'>knife search node <span class="s1">'platform:ubuntu'</span>
</span></code></pre></td></tr></table></div></figure>
<h1>Templates and Cross platform</h1>
<p>You can utilize Ruby within the recipe which can help to create dynamic run-lists. Combining variables, loops, case statements, etc. can make for some powerful conditional recipes.</p>
<p>Variable usage:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">package_name</span> <span class="o">=</span> <span class="s2">"apache2"</span>
</span><span class='line'>
</span><span class='line'><span class="k">if</span> <span class="n">node</span><span class="o">[</span><span class="ss">:platform</span><span class="o">]</span> <span class="o">==</span> <span class="s2">"centos"</span>
</span><span class='line'> <span class="n">package_name</span> <span class="o">=</span> <span class="s2">"httpd"</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'>
</span><span class='line'><span class="n">package</span> <span class="n">package_name</span> <span class="k">do</span>
</span><span class='line'> <span class="n">action</span> <span class="ss">:install</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>
<p>Case usage:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">package</span> <span class="s2">"apache2"</span> <span class="k">do</span>
</span><span class='line'> <span class="k">case</span> <span class="n">node</span><span class="o">[</span><span class="ss">:platform</span><span class="o">]</span>
</span><span class='line'> <span class="k">when</span> <span class="s2">"centos"</span><span class="p">,</span><span class="s2">"redhat"</span><span class="p">,</span><span class="s2">"fedora"</span><span class="p">,</span><span class="s2">"suse"</span>
</span><span class='line'> <span class="n">package_name</span> <span class="s2">"httpd"</span>
</span><span class='line'> <span class="k">when</span> <span class="s2">"debian"</span><span class="p">,</span><span class="s2">"ubuntu"</span>
</span><span class='line'> <span class="n">package_name</span> <span class="s2">"apache2"</span>
</span><span class='line'> <span class="k">when</span> <span class="s2">"arch"</span>
</span><span class='line'> <span class="n">package_name</span> <span class="s2">"apache"</span>
</span><span class='line'> <span class="k">end</span>
</span><span class='line'> <span class="n">action</span> <span class="ss">:install</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>
<p>Array iteration:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="o">[</span><span class="s2">"apache2"</span><span class="p">,</span> <span class="s2">"apache2-mpm"</span><span class="o">].</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="nb">p</span><span class="o">|</span>
</span><span class='line'> <span class="n">package</span> <span class="nb">p</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>
<p>We can utilize an Embedded Ruby template instead of static files that will be dynamically modified when copied down to our node. These are commonly named with a <code>.erb</code> suffix and can contain ruby code within text. In order to embed ruby we will need to utilize the <code><%= %></code> tag:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'><span class="nt"><html></span>
</span><span class='line'><span class="nt"><p></span>
</span><span class='line'> Hello, <span class="err"><</span>%= "my name is #{$ruby}" %>
</span><span class='line'><span class="nt"></p></span>
</span><span class='line'><span class="nt"></html></span>
</span></code></pre></td></tr></table></div></figure>
<p>We can feed in a template file with the <code>template</code> resource like this:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'>template "/etc/sudoers" do
</span><span class='line'> source "sudoers.erb"
</span><span class='line'> mode 0440
</span><span class='line'> owner "root"
</span><span class='line'> group "root"
</span><span class='line'> variables({
</span><span class='line'> :sudoers_groups => node[:authorization][:sudo][:groups],
</span><span class='line'> :sudoers_users => node[:authorization][:sudo][:users]
</span><span class='line'> })
</span><span class='line'>end
</span></code></pre></td></tr></table></div></figure>
<p>The sudoers.erb file referenced above will need to go into the <code>templates/default/sudoers.erb</code> instead of a typical file path at <code>files/default/sudoers.erb</code>. Chef will try to match up the most specific file by the client platform though and will look in this order:</p>
<p><code>templates/</code>
1. <code>host-node[:fqdn]/</code>
2. <code>node[:platform]-node[:platform_version]/</code>
3. <code>node[:platform]-version_components/</code>
4. <code>node[:platform]/</code>
5. <code>default/</code></p>
<p>For example, you could store the file in <code>templates/ubuntu-12.04/sudoers.erb</code>.</p>
<h1>Attributes</h1>
<p><code>Attributes</code> are specific details about a node and can be assigned from one of the following locations:</p>
<ul>
<li>Nodes (collected by Ohai at the start of each chef-client run)</li>
<li>Attribute files (in cookbooks)</li>
<li>Recipes (in cookbooks)</li>
<li>Environments</li>
<li>Roles</li>
</ul>
<p>The precedence level that determines which attribute is applied is as follows :</p>
<ol>
<li>A default attribute located in a cookbook attribute file</li>
<li>A default attribute located in a recipe</li>
<li>A default attribute located in an environment</li>
<li>A default attribute located in role</li>
<li>A force_default attribute located in a cookbook attribute file</li>
<li>A force_default attribute located in a recipe</li>
<li>A normal attribute located in a cookbook attribute file</li>
<li>A normal attribute located in a recipe</li>
<li>An override attribute located in a cookbook attribute file</li>
<li>An override attribute located in a recipe</li>
<li>An override attribute located in a role</li>
<li>An override attribute located in an environment</li>
<li>A force_override attribute located in a cookbook attribute file</li>
<li>A force_override attribute located in a recipe</li>
<li>An automatic attribute identified by Ohai at the start of the chef-client run</li>
</ol>
<p>You can more directly influence precedence by taking advantage of attribute types when getting and setting. The types available are (in order of precedence, lowest to highest):</p>
<ul>
<li><code>default</code> – lowest precedence, should be used in cookbooks when possible</li>
<li><code>force_default</code> – force attribute in cookbook to take over default set in an environment or role</li>
<li><code>normal</code> – not reset during chef-client run and has higher precedence than default</li>
<li><code>override</code> – reset at start of each client run</li>
<li><code>force_override</code> – ensure override in cookbook takes over for an override attribute in a role or environment</li>
<li><code>automatic</code> – discovered by <code>ohai</code> and has highest precedence</li>
</ul>
<p>To store attributes in a cookbook, we can place them in <code>attributes/default.rb</code>:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'># node object is implicit so we can actually do either of the following:
</span><span class='line'>node.default[:apache][:dir] = "/etc/apache2"
</span><span class='line'>node.default[:apache][:listen_ports] = [ "80","443" ]
</span><span class='line'>
</span><span class='line'># OR
</span><span class='line'>default[:apache][:dir] = "/etc/apache2"
</span><span class='line'>default[:apache][:listen_ports] = [ "80","443" ]
</span></code></pre></td></tr></table></div></figure>
<h1>Roles</h1>
<p>A good way to bridge together cookbooks and attributes for re-use. To start a role, start by creating an <code>.rb</code> file in your <code>roles/</code> folder in the chef repository. Here is an example of the three required attributes:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># roles/webserver.rb</span>
</span><span class='line'><span class="nb">name</span> <span class="s2">"webserver"</span>
</span><span class='line'><span class="n">description</span> <span class="s2">"The base role for systems that serve HTTP traffic"</span>
</span><span class='line'><span class="n">run_list</span> <span class="s2">"recipe[apache2]"</span><span class="p">,</span> <span class="s2">"recipe[apache2::mod_ssl]"</span><span class="p">,</span> <span class="s2">"role[monitor]"</span>
</span></code></pre></td></tr></table></div></figure>
<p>Common role tasks in knife:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># Upload a role</span>
</span><span class='line'>knife role from file webserver.rb
</span><span class='line'>
</span><span class='line'><span class="c"># Show roles</span>
</span><span class='line'>knife role list
</span><span class='line'>
</span><span class='line'><span class="c"># Show details on a specific role</span>
</span><span class='line'>knife role show webserver
</span><span class='line'>
</span><span class='line'><span class="c"># Delete a role</span>
</span><span class='line'>knife role delete webserver
</span><span class='line'>
</span><span class='line'><span class="c"># Add a role to a node</span>
</span><span class='line'>knife node run_list add chefclient <span class="s1">'role[webserver]'</span>
</span></code></pre></td></tr></table></div></figure>
<h1>Environments</h1>
<p>A way to logically break up workflow and reflect organizational patterns.
Every node can be assigned to a single environment. By default, all nodes
are part of the <code>_default</code> environment. You can create a new environment by creating a *.rb file in the <code>environments</code> folder of the chef-repo. This process is very similar to creating a new role. Your environment file needs
a <code>name</code>, <code>cookbook</code>, <code>description</code> (<code>default_attributes</code> and <code>override_attributes</code> are optional):</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># environments/dev.rb</span>
</span><span class='line'><span class="nb">name</span> <span class="s2">"dev"</span>
</span><span class='line'><span class="n">description</span> <span class="s2">"The development environment"</span>
</span><span class='line'><span class="n">cookbook_versions</span> <span class="s2">"couchdb"</span> <span class="o">=></span> <span class="s2">"= 11.0.0"</span>
</span><span class='line'><span class="n">default_attributes</span> <span class="s2">"apache2"</span> <span class="o">=></span> <span class="p">{</span> <span class="s2">"listen_ports"</span> <span class="o">=></span> <span class="o">[</span> <span class="s2">"80"</span><span class="p">,</span> <span class="s2">"443"</span> <span class="o">]</span> <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Here are some environment management commands from knife:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># Create environment from dev.rb file</span>
</span><span class='line'>knife environment create from file dev.rb
</span><span class='line'>
</span><span class='line'><span class="c"># Show available environments</span>
</span><span class='line'>knife environment list
</span><span class='line'>
</span><span class='line'><span class="c"># Show environment assignment for a node</span>
</span><span class='line'>knife node show <span class="nv">$nodename</span> | grep ^Env
</span></code></pre></td></tr></table></div></figure>
<p>It appears you’ll have to use a plugin to knife to modify environments but otherwise it is a very trivial task to perform from the chef server web interface.</p>
<h1>Community Cookbooks</h1>
<p>There is a great online resource for interacting with cookbooks from others online at <a href="http://community.opscode.com/cookbooks">http://community.opscode.com/cookbooks</a>. Once you find a good looking cookbook you’d like to pull into your own environment (after proper vetting of course), you can use knife to assist here:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># search the community site</span>
</span><span class='line'>knife cookbook site search chef-client
</span><span class='line'>
</span><span class='line'><span class="c"># show detail about a particular package</span>
</span><span class='line'>knife cookbook site show chef-client
</span><span class='line'>
</span><span class='line'><span class="c"># download community cookbook into local tar file</span>
</span><span class='line'>knife cookbook site download chef-client
</span><span class='line'>
</span><span class='line'><span class="c"># Install cookbook into cookbooks directory and commit changes</span>
</span><span class='line'>knife cookbook site install chef-client
</span></code></pre></td></tr></table></div></figure>
<p>From what I can tell, using the <code>site install</code> command is against chef best practices. You really should be vetting third-party code before pulling it down and committing it to your environment. There is a great community of chef tools and knife plugins out there. The Opscode folks have singled out some of the most common in the <a href="http://www.getchef.com/downloads/chef-dk/">Chef Development Kit</a>.</p>
<p>Okay! Great notes everyone!</p>
<h1>Reference</h1>
<ul>
<li><a href="http://youtu.be/H3Ggublb378">Fundamentals Webinar – Module 4</a></li>
<li><a href="http://youtu.be/46NQNzkCe_U">Fundamentals Webinar – Module 5</a></li>
<li><a href="http://docs.opscode.com/essentials_nodes_chef_run.html">Chef Run</a></li>
<li><a href="http://docs.opscode.com/auth.html">Authentication and Authorization</a></li>
<li><a href="http://docs.opscode.com/essentials_search.html">Searching</a></li>
<li><a href="http://docs.opscode.com/essentials_cookbook_recipes.html">Recipe Docs</a></li>
<li><a href="http://docs.opscode.com/chef_overview_attributes.html">Attributes</a></li>
</ul>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/05/05/jenkins-primer/">Jenkins Primer</a></h1>
<p class="meta">
<time datetime="2014-05-05T19:05:57-04:00" pubdate data-updated="true">May 5<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><h1>Installation</h1>
<p>Following directions from the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu">Jenkins</a> site, these are my notes to configuring a base Jenkins setup on Ubuntu 12.04. Let’s first start by adding the jenkins repository, refreshing the apt repository listing, installing, and
starting up:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
</span><span class='line'>sudo sh -c <span class="s1">'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'</span>
</span><span class='line'>sudo apt-get update
</span><span class='line'>sudo apt-get install jenkins
</span><span class='line'>sudo service jenkins start
</span></code></pre></td></tr></table></div></figure>
<p>By default, you’ll be able to reach the jenkins server over HTTP on port 8080. Here is the screen you are greeted with:
<img class="center" src="/images/jenkins-install1.png"></p>
<p>Our jekins configuration files live at <code>/var/lib/jenkins</code> which happens to be the home directory for our new <code>jenkins</code> user. Here is a default directory listing upon installation:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>jenkins@precise64:~<span class="nv">$ </span>tree -d -L 2
</span><span class='line'>.
</span><span class='line'>|-- <span class="nb">jobs</span>
</span><span class='line'>|-- plugins
</span><span class='line'>| |-- ant
</span><span class='line'>| |-- antisamy-markup-formatter
</span><span class='line'>| |-- credentials
</span><span class='line'>| |-- cvs
</span><span class='line'>| |-- external-monitor-job
</span><span class='line'>| |-- javadoc
</span><span class='line'>| |-- ldap
</span><span class='line'>| |-- mailer
</span><span class='line'>| |-- matrix-auth
</span><span class='line'>| |-- matrix-project
</span><span class='line'>| |-- maven-plugin
</span><span class='line'>| |-- pam-auth
</span><span class='line'>| |-- ssh-credentials
</span><span class='line'>| |-- ssh-slaves
</span><span class='line'>| |-- subversion
</span><span class='line'>| |-- translation
</span><span class='line'>| <span class="sb">`</span>-- windows-slaves
</span><span class='line'>|-- secrets
</span><span class='line'>|-- updates
</span><span class='line'><span class="sb">`</span>-- userContent
</span></code></pre></td></tr></table></div></figure>
<h1>Plug-ins</h1>
<p>Jenkins is configurable with <a href="https://wiki.jenkins-ci.org/display/JENKINS/Plugins">community plugins</a>. For my project, I wanted to include git support but by default jenkins only supports CVS and subversion. Turns out you can easily install plugins via the web-interface. Make sure you already have <code>git</code> installed on the jenkins server. From the main page:</p>
<ol>
<li>click <code>Manage Jekins</code></li>
<li><code>Manage Plugins</code></li>
<li><code>Available</code></li>
<li>Type ‘git plugin’ in the search bar</li>
<li>Select the Git Plugin and <code>Download and Reboot</code> <img class="center" src="/images/jenkins-install-gitpl.png"></li>
<li>Select the option to reboot when no jobs are running</li>
</ol>
<h1>Run tests against a git project</h1>
<p>From our main jenkins page:</p>
<ol>
<li><code>New item</code></li>
<li>Fill out <code>Item name</code> and select <code>Build a free-style software project</code></li>
<li>Scroll down to source code management and select <code>git</code></li>
<li>Enter the URL of the git repository and any credentials you may need. For my test purposes I pointed to a file-system path that I have shared with my jenkins test server. If jenkins can’t reach the git URL you’ll get an error before you hit save which is nice.</li>
<li>Under <code>Build Triggers</code> – set up a schedule under <code>Poll SCM</code>. The syntax is similar to Unix crontab. The documentation recommends that you utilize an H in place of a field in order to help distribute the workload amongst multiple jobs. For example <code>H * * * *</code> will run a job every hour at a variable minute related to other scheduled jobs.</li>
<li>Finally under <code>build</code>/<code>Execute Shell</code> – set up the scripts that are necessary for testing your project. Here was an example for mine that I found from a <a href="http://iamnearlythere.com/jenkins-python-virtualenv/">blogger</a> :</li>
</ol>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">PATH</span><span class="o">=</span><span class="nv">$WORKSPACE</span>/venv/bin:/usr/local/bin:<span class="nv">$PATH</span>
</span><span class='line'><span class="k">if</span> <span class="o">[</span> ! -d <span class="s2">"venv"</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k"> </span>virtualenv venv
</span><span class='line'><span class="k">fi</span>
</span><span class='line'>. venv/bin/activate
</span><span class='line'>
</span><span class='line'>pip install -r requirements.txt
</span><span class='line'>nosetests -v -s
</span></code></pre></td></tr></table></div></figure>
<p>You can manually kick off a build from the Jenkins job page using <code>Build now</code>. You can follow it live with the console view to see the output from the scripts. The git files will be pulled into your build workspace which for our Ubuntu install was <code>/var/lib/jenkins/jobs/project_name/workspace/</code></p>
<h1>Git Hook</h1>
<p>You can tie a build into your git repo using a <a href="http://git-scm.com/book/en/Customizing-Git-Git-Hooks">git hook</a> and by supplying a specially formatted HTTP GET request to your jenkins server. You won’t have to authenticate to jenkins to kick this off, so just keep that in mind during deployment. It is recommended to use <code>curl</code> to kick this off using the following format:</p>
<p><code>curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]</code></p>
<p>The git jenkins plugin will determine what jobs are associated with the <code><URL of the Git repository></code> and start those builds. You’ll need to setup some kind of polling configuration on the job in order for this to work right.</p>
<p>Overall it was fairly painless to get it up and running for testing purposes. I didn’t do any due dilligence to lock this down in my vagrant environment but that would be a primary concern for me when rolling this out in a production environment.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/05/04/chef-getting-started-with-recipes/">Chef - Getting Started With Recipes</a></h1>
<p class="meta">
<time datetime="2014-05-04T17:20:04-04:00" pubdate data-updated="true">May 4<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p><img class="center" src="/images/recipe_book.jpg"></p>
<p>Check out my primer chef document for how to initially configure your chef test environment with vagrant. This document assumes you are starting from there.</p>
<h1>Apache Tutorial Cookbook</h1>
<p>These are my expanded notes from one of the official <a href="https://learnchef.opscode.com/tutorials/create-your-first-cookbook/">docs</a>. Before we proceed, let’s take a quick look at the default <a href="https://github.com/opscode/chef-repo">chef-repo</a> tree:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>chef-repo
</span><span class='line'>├── .chef
</span><span class='line'>├── certificates
</span><span class='line'>├── config
</span><span class='line'>├── cookbooks
</span><span class='line'>├── data_bags
</span><span class='line'>├── environments
</span><span class='line'>└── roles</span></code></pre></td></tr></table></div></figure>
<p>When you are inside that directory and have already configured your knife config file, you can start a cookbook with:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>knife cookbook create apache_tutorial</span></code></pre></td></tr></table></div></figure>
<p>Let’s see how this changes our workspace:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>chef-repo
</span><span class='line'>└── cookbooks
</span><span class='line'> └── apache_tutorial
</span><span class='line'> ├── attributes
</span><span class='line'> ├── CHANGELOG.md
</span><span class='line'> ├── definitions
</span><span class='line'> ├── files
</span><span class='line'> │ └── default
</span><span class='line'> ├── libraries
</span><span class='line'> ├── metadata.rb
</span><span class='line'> ├── providers
</span><span class='line'> ├── README.md
</span><span class='line'> ├── recipes
</span><span class='line'> │ └── default.rb
</span><span class='line'> ├── resources
</span><span class='line'> └── templates
</span><span class='line'> └── default</span></code></pre></td></tr></table></div></figure>
<p>Make the following modifications:</p>
<p><code>recipes/default.rb</code>:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>package "apache2" do
</span><span class='line'> action :install
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>service "apache2" do
</span><span class='line'> action [ :enable, :start ]
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>cookbook_file "/var/www/index.html" do
</span><span class='line'> source "index.html"
</span><span class='line'> mode "0644"
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>
<p><code>files/default/index.html</code>:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'><html>
</span><span class='line'><body>
</span><span class='line'> <h1>Hello, world!</h1>
</span><span class='line'></body>
</span><span class='line'></html></span></code></pre></td></tr></table></div></figure>
<p>Upload that recipe to the chef server:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ knife cookbook upload apache_tutorial</span></code></pre></td></tr></table></div></figure>
<h1>Run List</h1>
<p>Now we need to add that recipe to our node’s <code>run list</code>. To verify the run list of a node:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ knife node show chefclient
</span><span class='line'>Node Name: chefclient
</span><span class='line'>Environment: _default
</span><span class='line'>FQDN: ChefClient
</span><span class='line'>IP: 10.0.2.15
</span><span class='line'>Run List:
</span><span class='line'>Roles:
</span><span class='line'>Recipes:
</span><span class='line'>Platform: ubuntu 12.04
</span><span class='line'>Tags:</span></code></pre></td></tr></table></div></figure>
<p>Let’s add our apache recipe to that node’s runlist and confirm:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>knife node run_list add chefclient apache_tutorial
</span><span class='line'>chefclient:
</span><span class='line'> run_list: recipe<span class="o">[</span>apache_tutorial<span class="o">]</span>
</span><span class='line'>
</span><span class='line'><span class="nv">$ </span>knife node show chefclient
</span><span class='line'>Node Name: chefclient
</span><span class='line'>Environment: _default
</span><span class='line'>FQDN: ChefClient
</span><span class='line'>IP: 10.0.2.15
</span><span class='line'>Run List: recipe<span class="o">[</span>apache_tutorial<span class="o">]</span>
</span><span class='line'>Roles:
</span><span class='line'>Recipes:
</span><span class='line'>Platform: ubuntu 12.04
</span><span class='line'>Tags:
</span></code></pre></td></tr></table></div></figure>
<p>To force our chefclient to run this recipe and check into our chef server:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>knife ssh <span class="s2">"name:chefclient"</span> -x vagrant -P vagrant <span class="s2">"sudo chef-client"</span>
</span></code></pre></td></tr></table></div></figure>
<h1>References</h1>
<ul>
<li><a href="http://docs.opscode.com/chef/resources.html">Chef Resources/Providers Reference</a></li>
<li><a href="https://learnchef.opscode.com/tutorials/create-your-first-cookbook/">Chef Tutorial</a></li>
<li><a href="http://docs.opscode.com/essentials_search.html">Chef Query</a></li>
</ul>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/05/04/a-chef-primer/">A Chef Primer</a></h1>
<p class="meta">
<time datetime="2014-05-04T17:19:40-04:00" pubdate data-updated="true">May 4<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p><img class="center" src="/images/chef_veggies.jpg"></p>
<h3>Vagrant</h3>
<p>My focus was to learn about Chef while using Vagrant for easy machine management. I’m pretty familiar with the basics of vagrant already but there were two extras I needed for this project:
1. Quick snapshoting capabilities