Produced by Araxis Merge on 10/2/2017 1:40:04 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | chef-repo.zip\chef-repo\machine_cookbooks\machine | README.md | Wed Jul 12 17:27:18 2017 UTC |
| 2 | chef-repo.zip\chef-repo\machine_cookbooks\machine | README.md | Mon Oct 2 12:37:59 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 480 |
| Changed | 3 | 6 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | The Machin e Cookbook | |
| 2 | ========== ======= | |
| 3 | The machin e cookbook is design ed to be a utility f or the pro vision coo kbooks to include fo r base che f-provisio ning funct ionality. | |
| 4 | ||
| 5 | The defaul t recipe i n this coo kbook cont ains gener ic configu rations to be used b y any mach ine create d using ch ef-provisi oning. The default a ttributes file conve rts all th e relevant environme nt variabl es to chef attribute s and defi nes some b ase attrib utes to be used on t he host ch ef-run. | |
| 6 | ||
| 7 | Requiremen ts | |
| 8 | ---------- -- | |
| 9 | #### Cookb ooks | |
| 10 | This cookb ook depend s only on the common cookbook, but is a dependency of all pr ovision co okbooks. | |
| 11 | ||
| 12 | #### Gems | |
| 13 | - chef-pro visioning "= 0.18" | | "= 1.3.0 " | |
| 14 | - chef-pro visioning- vagrant "= 0.0.9" | |
| 15 | - chef-pro visioning- aws "~> 1. 3.1" | |
| 16 | - chef-pro visioning- ssh "~> 0. 8.1" | |
| 17 | - awscli | |
| 18 | - aws-sdk | |
| 19 | ||
| 20 | #### Other | |
| 21 | - *Vagrant * (if usin g the 'vag rant' driv er) | |
| 22 | - *Amazon Web Servic es* creden tials at ~ /.aws/cred entials an d the aws- cli (if us ing the 'a ws' driver ) | |
| 23 | - A data b ag called "productio n_settings " with a d ata bag it em that li sts all th e IP addre sses and s sh connect ion creden tials of t he target machine (i f specifie d by envir onment var iable PROD UCTION_DAT A_BAG) | |
| 24 | ```json | |
| 25 | { | |
| 26 | "machi ne-1": { | |
| 27 | "ip_addres s": " IP ", | |
| 28 | "ssh _username" : "vagrant ", | |
| 29 | "ssh _keyname": "~/.vagra nt.d/insec ure_privat e_key" | |
| 30 | }, | |
| 31 | "machi ne-2": { | |
| 32 | "ip_addres s": " IP ", | |
| 33 | "ssh _username" : "vagrant ", | |
| 34 | "ssh _keyname": "~/.vagra nt.d/insec ure_privat e_key" | |
| 35 | } | |
| 36 | } | |
| 37 | ``` | |
| 38 | ||
| 39 | Usage | |
| 40 | ----- | |
| 41 | #### machi ne::defaul t | |
| 42 | The defaul t recipe o f the mach ine cookbo ok depends on certai n environm ent variab les. Alth ough there are defau lt values for each a ttribute, the recomm endation i s to contr ol the val ues with e nvironment variables . | |
| 43 | ||
| 44 | Environmen t Variable s (Attribu tes) | |
| 45 | ---------- | |
| 46 | <table> | |
| 47 | <tr> | |
| 48 | <th>Ke y</th> | |
| 49 | <th>De scription< /th> | |
| 50 | <th>De fault</th> | |
| 51 | </tr> | |
| 52 | <tr> | |
| 53 | <td><t t>[:name]< /tt></td> | |
| 54 | <td>Na me of the machine</t d> | |
| 55 | <td><t t>ENV['MAC HINE_NAME' ] || "all- machines"< /tt></td> | |
| 56 | </tr> | |
| 57 | <tr> | |
| 58 | <td><t t>[:stack] </tt></td> | |
| 59 | <td>Na me of the stack; eit her $JOB_N AME or $US ER</td> | |
| 60 | <td><t t>ENV['JOB _NAME'] || ENV['USER ']</tt></t d> | |
| 61 | </tr> | |
| 62 | <tr> | |
| 63 | <td><t t>[:driver ]</tt></td > | |
| 64 | <td>Dr iver to us e when boo ting the m achine</td > | |
| 65 | <td><t t>ENV['DRI VER'] || " vagrant"</ tt></td> | |
| 66 | </tr> | |
| 67 | <tr> | |
| 68 | <td><t t>[:action ]</tt></td > | |
| 69 | <td>Ac tion to de fine in th e creation of machin e resource s</td> | |
| 70 | <td><t t>ENV['ACT ION'] || " converge"< /tt></td> | |
| 71 | </tr> | |
| 72 | <tr> | |
| 73 | <td><t t>[:enviro nment]</tt ></td> | |
| 74 | <td>Ch ef environ ment to be used by t he guest n ode</td> | |
| 75 | <td><t t>ENV['ENV IRONMENT'] || node.e nvironment </tt></td> | |
| 76 | </tr> | |
| 77 | <tr> | |
| 78 | <td><t t>[:batch_ action]</t t></td> | |
| 79 | <td>Th e action u sed in bat ch deploys using par allel mach ine_batch resources< /td> | |
| 80 | <td><t t>"converg e_only"</t t></td> | |
| 81 | </tr> | |
| 82 | <tr> | |
| 83 | <td><t t>[:allow_ web_access ]</tt></td > | |
| 84 | <td>De fine wheth er or not to allow g uest nodes to access the inter net during deploymen t</td> | |
| 85 | <td><t t>ENV['ALL OW_WEB_ACC ESS'] || f alse</tt>< /td> | |
| 86 | </tr> | |
| 87 | <tr> | |
| 88 | <td><t t>[:cache_ upload]</t t></td> | |
| 89 | <td>De fine wheth er or not to upload the cache of package s after th e deployme nt</td> | |
| 90 | <td><t t>ENV['CAC HE_UPLOAD' ] || false </tt></td> | |
| 91 | </tr> | |
| 92 | </table> | |
| 93 | ||
| 94 | Standard A ttributes | |
| 95 | ---------- | |
| 96 | <table> | |
| 97 | <tr> | |
| 98 | <th>Ke y</th> | |
| 99 | <th>De scription< /th> | |
| 100 | <th>De fault</th> | |
| 101 | </tr> | |
| 102 | <tr> | |
| 103 | <td><t t>[:batch_ action]</t t></td> | |
| 104 | <td>Th e action u sed in bat ch deploys using par allel mach ine_batch resources< /td> | |
| 105 | <td><t t>"converg e_only"</t t></td> | |
| 106 | </tr> | |
| 107 | <tr> | |
| 108 | <td><t t>[:conver gence_opti ons]</tt>< /td> | |
| 109 | <td>A hash of op tions to b e passed t o chef pro visioning in ssh mac hine resou rces</td> | |
| 110 | <td><t t> | |
| 111 | { | |
| 112 | chef _config: " diff_disab led true\n ", | |
| 113 | chef _version: "12.3.0" | |
| 114 | } | |
| 115 | </tt>< /td> | |
| 116 | </tr> | |
| 117 | <tr> | |
| 118 | <td><t t>[:copy_f iles]</tt> </td> | |
| 119 | <td>A hash of :g uest_path => :host_p ath files to copy on to the gue st node ma chines as they are c reated</td > | |
| 120 | <td><t t> | |
| 121 | { | |
| 122 | "/et c/chef/hos t_key.pem" => ::Chef ::Config.c lient_key | |
| 123 | } | |
| 124 | </tt>< /td> | |
| 125 | </tr> | |
| 126 | <tr> | |
| 127 | <td><t t>[:image_ id]</tt></ td> | |
| 128 | <td>Am azon Web S ervices im age id use d when boo ting into the aws en vironment< /td> | |
| 129 | <td><t t>*depends on AWS ac count*</tt ></td> | |
| 130 | </tr> | |
| 131 | <tr> | |
| 132 | <td><t t>[:box_na me]</tt></ td> | |
| 133 | <td>Va grant box name used when booti ng into th e vagrant environmen t</td> | |
| 134 | <td><t t>"opscode -centos-6. 5-users"</ tt></td> | |
| 135 | </tr> | |
| 136 | <tr> | |
| 137 | <td><t t>[:box_ur l]</tt></t d> | |
| 138 | <td>UR L to the b ox file on artifact server</td > | |
| 139 | <td><t t>*depends on Nexus url*</tt>< /td> | |
| 140 | </tr> | |
| 141 | <tr> | |
| 142 | <td><t t>[:produc tion_setti ngs]</tt>< /td> | |
| 143 | <td>Em pty hash t o later be overwritt en by eith er a produ ction sett ings data bag or the boot cust om resourc e</td> | |
| 144 | <td><t t>{}</tt>< /td> | |
| 145 | </tr> | |
| 146 | </table> | |
| 147 | ||
| 148 | Custom Res ources | |
| 149 | ---------- ------ | |
| 150 | #### machi ne_boot | |
| 151 | This is a custom res ource desi gned to bo ot a machi ne in eith er of the two suppor ted enviro nments (Va grant and Amazon Web Services) . In a pr oduction e nvironment where ser vers are m anaged by a 3rd part y and out of the con trol of th is project , this res ource will do nothin g (i.e.: a ction :ssh ). | |
| 152 | ||
| 153 | The follow ing code s hould be a dded to ea ch provisi oner recip e and will boot a ma chine usin g the spec ified driv er if the machine wa s not prev iously def ined by th e producti on setting s data bag in the no de[:machin e][:produc tion_setti ngs] attri bute. The assumptio n is that either a d ata bag wa s not prov ided or th e machine was not in the data bag and th erefore, a new machi ne needs t o be creat ed. | |
| 154 | ||
| 155 | ```ruby | |
| 156 | machine_ boot "boot #{machine _ident} ma chine to t he #{node[ :machine][ :driver]} environmen t" do | |
| 157 | machin e_name mac hine_ident | |
| 158 | boot_o ptions boo t_options | |
| 159 | driver node[:mac hine][:dri ver] | |
| 160 | action node[:mac hine][:dri ver] | |
| 161 | only_i f { node[: machine][: production _settings] [machine_i dent.to_sy m].nil? } | |
| 162 | end | |
| 163 | ``` | |
| 164 | Above, boo t_options is a hash which cont ains the c ustomized values for a given m achine usi ng a given driver wh ich will d efine how a machine is booted. | |
| 165 | ||
| 166 | #### machi ne_artifac ts | |
| 167 | This is a custom res ource whic h will cre ate a dire ctory cont aining eac h of the a rtifacts d efined by a given pr ovision co okbook's a ttributes. It is us ed in a re cipe like the follow ing: | |
| 168 | ||
| 169 | ```ruby | |
| 170 | # Cookbook Name:: pr ovisioner | |
| 171 | # Recipe:: download_ artifacts | |
| 172 | ||
| 173 | machine_ar tifacts "d ownload al l artifact s defined by provisi oner" do | |
| 174 | provisio ner_cookbo ok "provis ioner" | |
| 175 | action : download | |
| 176 | end | |
| 177 | ||
| 178 | ``` | |
| 179 | ||
| 180 | Libraries (Classes) | |
| 181 | ---------- -- | |
| 182 | #### vagra nt_options | |
| 183 | This libra ry is inte nded to mo dify the c hef-provis ioning-vag rant drive r code dur ing runtim e. This i s a short term modif ication of the Chef: :Provision ing::Vagra ntDriver:: Driver.cre ate_vm_fil e method w hich gener ates the . vm vagrant file for a machine u sing chef- provisioni ng. This modificati on is bein g made to extend the functiona lity of th is method and enhanc e the read ability of the code as opposed to altern ative solu tions prov ided by ch ef-provisi oning. | |
| 184 | ||
| 185 | The follow ing option s can be s et in hash form: | |
| 186 | ||
| 187 | ```ruby | |
| 188 | { | |
| 189 | :vagrant _options = > { | |
| 190 | :box = > "vagrant -box-name" , | |
| 191 | :netwo rk => { | |
| 192 | :pri vate_netwo rk => { | |
| 193 | :ip => " IP " | |
| 194 | } | |
| 195 | }, | |
| 196 | :provi der => { | |
| 197 | :vir tualbox => { | |
| 198 | :n ame => "vb ox-test-ma chine", | |
| 199 | :c pus => 4, | |
| 200 | :m emory => 1 024 | |
| 201 | } | |
| 202 | }, | |
| 203 | :synce d_folder = > [ | |
| 204 | { | |
| 205 | :h ost_path = > "#{ENV[' HOME']}/Do wnloads", | |
| 206 | :g uest_path => "/home/ vagrant/Do wnloads", | |
| 207 | :c reate => t rue | |
| 208 | }, | |
| 209 | { | |
| 210 | :h ost_path = > "/var/ch ef/cache/c ookbooks", | |
| 211 | :g uest_path => "/var/c hef/cache/ cookbooks" , | |
| 212 | :c reate => t rue | |
| 213 | } | |
| 214 | ] | |
| 215 | } | |
| 216 | } | |
| 217 | ``` | |
| 218 | and applie d to a mac hine resou rce using: | |
| 219 | ||
| 220 | ```ruby | |
| 221 | machine "v box-test-m achine" do | |
| 222 | machine_ options na me_of_hash _above | |
| 223 | end | |
| 224 | ``` | |
| 225 | ||
| 226 | NOTE: The re are add itional co nfiguratio n options defined by chef-prov isioning-v agrant, ch ef-provisi oning and vagrant wh ich can be set in th e machine_ options ha sh. The b est source of this i nformation is https: //github.c om/chef/ch ef-provisi oning, htt ps://githu b.com/chef /chef-prov isioning-v agrant and https://g ithub.com/ mitchellh/ vagrant | |
| 227 | ||
| 228 | #### vagra nt_driver_ chef_insta ll | |
| 229 | This libra ry is inte nded to mo dify the c hef-provis ioning-vag rant drive r code dur ing runtim e. This i s a short term modif ication of the Chef: :Provision ing::Vagra ntDriver:: Driver.con vergence_s trategy_fo r method w hich defin es Converg ence Strat egy to use to instal l chef on guest node s. When t his librar y is loade d, it will force Lin ux and Mac OS X mach ines to in stall chef using she ll script rather tha n the defa ult strate gy of inst alled a ca ched packa ge. | |
| 230 | ||
| 231 | Libraries (Methods O nly) | |
| 232 | ---------- -- | |
| 233 | ||
| 234 | #### artif act_url | |
| 235 | This is a simple def inition us ed to cons truct the REST url f or Nexus a rtifacts. | |
| 236 | ||
| 237 | #### set_e c2_tags | |
| 238 | This is a simple def inition us ed to cons truct a ha sh of EC2 tags to be used when provision ing a mach ine using the 'aws' driver. | |
| 239 | ||
| 240 | License an d Authors | |
| 241 | ---------- --------- | |
| 242 | Authors: | |
| 243 | Team Milky way <team- milkyway@v istacore.u s> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.