Changes between Version 5 and Version 6 of ChefonDETER
- Timestamp:
- Jul 14, 2014 2:39:11 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ChefonDETER
v5 v6 7 7 The workflow for a running system is recipes, roles, and chef code is written on a workstation and added to a chef repository. The person on the workstation then pushes updates to the chef server. The client then contacts the chef server for updates, gets the updates, and applies them locally. {{{Knife}}}, on a workstation, can also install Chef-client (and other packages) directly on a client. If this is done the flow becomes: 1) workstation pushes update to the server, 2) the workstation installs Chef on a client and gives it an initial role or list of recipes, 3) the newly installed {{{chef-client}}} then contacts the chef server and downloads the recipes and executes them, configuring the client node. 8 8 9 Swap in an experiment with at least t wo Ubuntu 12.04 nodes, one of which will be the Chef server and one will be the client.9 Swap in an experiment with at least three Ubuntu 12.04 nodes, one {{{server}}}, one {{{workstation}}}, and one {{{client}}}. 10 10 11 11 === Chef Server === … … 24 24 This can be the same machine as the server. First we install the package, then configure it. The configuration involves cloning the {{{chef-repo}}} git repository that has the DETER specific recipes. We also set up a trusted user and the appropriate keys. 25 25 26 Install Chef software: 26 27 {{{ 27 28 > ssh workstation 28 > sudo dpkg -i /share/chef/chef_11.1 2.2-1_amd64.deb29 > sudo dpkg -i /share/chef/chef_11.10.4-1.ubuntu.12.04_amd64.deb 29 30 > chef-client -v # test - should show version. 31 }}} 32 33 Configure admin user and set up keys. Note there is a web interface for this. Since it assumes you're running the browser locally though, you need to setup an ssh tunnel and a web proxy like Foxy-Proxy to access it. For this script, we just stick to the command line. For this though, we need to copy private keys. The procedure for using the web API copies public keys from a web page. 34 35 Install git and the chef-repo: 36 {{{ 30 37 > sudo apt-get install -y git # chef uses git. 31 > sudo chmod g+ x/local38 > sudo chmod g+w /local 32 39 > cd /local 33 40 > git clone /share/chef/chef-repo 41 > cd chef-repo 42 > mkdir .chef 43 > # copy keys! 44 > ssh server sudo cat /etc/chef-server/admin.pem > .chef/admin.pem 45 > ssh server sudo cat /etc/chef-server/chef-validator.pem > .chef/chef-validator.pem 46 > # use knife to configure the account/workstation 47 > knife configure --initial 34 48 }}} 49 50 Answer the questions, substituting in your uid and server's control-net FQDN. A sample run is shown here: 51 {{{ 52 > knife configure --initial 53 WARNING: No knife configuration file found 54 Where should I put the config file? [/users/glawler/.chef/knife.rb] /local/chef-repo/.chef/knife.rb 55 Please enter the chef server URL: [https://pc40.isi.deterlab.net:443] https://pc46.isi.deterlab.net:443 56 Please enter a name for the new user: [glawler] 57 Please enter the existing admin name: [admin] 58 Please enter the location of the existing admin's private key: [/etc/chef-server/admin.pem] /local/chef-repo/.chef/admin.pem 59 Please enter the validation clientname: [chef-validator] 60 Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] /local/chef-repo/.chef/chef-validator.pem 61 Please enter the path to a chef repository (or leave blank): /local/chef-repo 62 Creating initial API user... 63 Please enter a password for the new user: 64 Created user[glawler] 65 Configuration file written to /local/chef-repo/.chef/knife.rb 66 > # Validate server connection and user. 67 > knife user list 68 admin 69 glawler 70 > 71 }}} 72 Take a look in {{{/local/chef-repo/cookbooks/deter_node/recipes}}} for the "deter_node" recipes. There is also a simple "deter_node" role in {{{/local/chef-repo/roles/deter_node.rb}}} that has a {{{run_list}}} that tells the node to execute the recipes in the correct order. 73 74 In order to talk to the chef server with authority, we set up an {{{admin}}} user and distribute/generate keys. 75 {{{ 76 35 77 36 78 === Chef Client(s) === … … 39 81 40 82 {{{ 41 > ssh client 42 > 83 > # already installed via knife bootstrap. 43 84 }}} 44 85