Changes between Version 7 and Version 8 of ChefonDETER


Ignore:
Timestamp:
Jul 14, 2014 4:10:03 PM (10 years ago)
Author:
Geoff Lawler
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChefonDETER

    v7 v8  
    7676}}}
    7777
     78Note that the {{{knife}}} command looks in ~/.chef and $(cwd)./chef for configuration files, so execute all {{{knife}}} commands from the {{{/local/chef-repo}}} directory or {{{knife}}} will be dull and not-happy.
     79
     80Push the local roles and recipes to the chef server.
     81{{{
     82> cd /local/chef-repo
     83> knife cookbook upload hostsfile deter_node
     84Uploading hostsfile    [2.4.4]                                                               
     85Uploading deter_node   [0.1.1]                                                               
     86Uploaded 2 cookbooks.                                                                       
     87> knife role from file roles/deter_node.rb
     88Updated Role deter_node!
     89> # Confirm things are OK.
     90> knife cookbook list
     91deter_node   0.1.1
     92hostsfile    2.4.4
     93> knife role list
     94deter_node
     95>
     96}}}
     97
     98We are now going to use {{{knife}}} to bootstrap Chef unto a client machine. The usual Chef assumes internet connectivity and asks you to download a script and pipe it to {{{sudo}}} on the client. We will not be doing that.
     99
     100{{{
     101> cd /local/chef-repo
     102> mkdir .chef/bootstrap
     103> cp /share/chef/ubuntu12.04-deb.erb .chef/bootstrap
     104}}}
     105
     106The bootstrap usually grabs the package file from the internet. We give {{{chef}}} a custom bootstrap script that looks for it at {{{users:8523}}}. This means something on {{{users}}} must be listening on port 8523 and understand how to serve files via HTTPS. We use python for this. On {{{users}}}, cd to /share/chef and run {{{python -m SimpleHTTPServer 8523}}}. This starts a simple HTTP server on port 8523. If you want to run on your local server instead edit the file {{{/local/chef-repo/.chef/bootstrap/ubuntu12.04-deb.erb}}}, set the {{{SERVER}}} variable to the control net FQDN/ip address of your server and run the python simple server there.
     107
     108Now run the bootstrap command to install and configure chef on the client. {{{$NODE}}} is the control net name of the client node, like {{{pc33.isi.deterlab.net}}} and {{{$USER}}} if your sudo-able user name, like {{{glawler}}} or {{{faber}}}.
     109
     110{{{
     111> knife bootstrap $NODE -x $USER --sudo --distro ubuntu12.04-deb
     112}}}
     113
     114Now kill the python SimpleHTTPServer process on users.
     115
     116Confirm the node has chef installed and configured by running this {{{knife}}} command on your workstation machine. It should show the client node.
     117
     118{{{
     119> cd /local/chef-repo
     120> knife client list
     121chef-validator
     122chef-webui
     123pc33.isi.deterlab.net
     124> # show the node information:
     125> knife node show pc33.isi.deterlab.net
     126Node Name:   pc33.isi.deterlab.net
     127Environment: _default             
     128FQDN:        pc33.isi.deterlab.net
     129IP:          192.168.1.33         
     130Run List:                         
     131Roles:                             
     132Recipes:                           
     133Platform:    ubuntu 12.04         
     134Tags:                             
     135}}}
     136
     137Now we assign recipes or a role to the client node and tell it to configure itself. (Note this could've been done during the bootstrap via the {{{-r}}} argument.
     138
     139{{{
     140workstation$ knife node run_list add pc33.isi.deterlab.net 'role[deter_node]'
     141pc33.isi.deterlab.net:     
     142  run_list: role[deter_node]
     143}}}
    78144
    79145=== Chef Client(s) ===
     
    82148
    83149{{{
    84 > # already installed via knife bootstrap.
     150> # already installed via knife bootstrap!
    85151}}}
    86152