Thursday, August 7, 2014

Installing cookbook on chef node


Installing chef on chef node
$ knife solo prepare chef-node01
Bootstrapping Chef...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16519  100 16519    0     0  14721      0  0:00:01  0:00:01 --:--:-- 14722
Downloading Chef 11.14.2 for el...
downloading https://www.opscode.com/chef/metadata?v=11.14.2&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64
  to file /tmp/install.sh.17808/metadata.txt
trying wget...
url     https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.14.2-1.el6.x86_64.rpm
md5     ffeffb67c310e6f76bb5d90ee7e30a3f
sha256  840946bc5f7931346131c0c77f2f5bfd1328245189fc6c8173b01eb040ffb58b
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.14.2-1.el6.x86_64.rpm
  to file /tmp/install.sh.17808/chef-11.14.2-1.el6.x86_64.rpm
trying wget...
Comparing checksum with sha256sum...
Installing Chef 11.14.2
installing with rpm...
warning: /tmp/install.sh.17808/chef-11.14.2-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:chef-11.14.2-1.el6               ################################# [100%]
Thank you for installing Chef!
Generating node config './nodes/chef-node01.json'...
Creating node object file
nodes/chef-node01.json
{   "run_list":[      "recipe[hello]"   ] }
Uploading chef-repo and running chef-solo on chef node
$ knife solo cook chef-node01
Running Chef on chef-node01...
Checking Chef version...
Uploading the kitchen...
Generating solo config...
Running Chef...
[2014-08-06T02:59:42+00:00] WARN: 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.

To fix this issue add an entry like this to your configuration file:

```
  # Verify all HTTPS connections (recommended)
  ssl_verify_mode :verify_peer

  # OR, Verify only connections to chef-server
  verify_api_cert true
```

To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:

```
  knife ssl check -c /home/ec2-user/chef-solo/solo.rb
```

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Starting Chef Client, version 11.14.2
Compiling Cookbooks...
Converging 1 resources
Recipe: hello::default
  * log[Hello, Chef!] action write
  

Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 1.310583027 seconds
I added the following entry to configure SSL for the chef-client.
~/chec-repo/.chef/knife.rb
ssl_verify_mode :verify_peer
The warning message has not output any more.
$ knife solo cook chef-node01
Running Chef on chef-node01...
Checking Chef version...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.14.2
Compiling Cookbooks...
Converging 1 resources
Recipe: hello::default
  * log[Hello, Chef!] action write
  

Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 1.310583027 seconds
Creating a cookbook to install dstat
$ knife cookbook create dstat -o site-cookbooks
** Creating cookbook dstat
** Creating README for cookbook: dstat
** Creating CHANGELOG for cookbook: dstat
** Creating metadata for cookbook: dstat
Creating a recipe to install dstat


site-cookbooks/dstat/recipes/default.rb
package "dstat" do
  action :install
end
Adding run_list on object node file


nodes/chef-node01.json
  "run_list" : [
    "recipe[hello]", 
    "recipe[dstat]"
  ]
}
Running cookbook on chef node and specifying a recipe to run
$ knife solo cook chef-node01 -o dstat
Running Chef on chef-node01...
Checking Chef version...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.14.2
[2014-08-08T06:42:27+00:00] WARN: Run List override has been provided.
[2014-08-08T06:42:27+00:00] WARN: Original Run List: [recipe[hello], recipe[dstat]]
[2014-08-08T06:42:27+00:00] WARN: Overridden Run List: [recipe[dstat]]
Compiling Cookbooks...
Converging 1 resources
Recipe: dstat::default
  * package[dstat] action install
    - install version 0.7.0-1.5.amzn1 of package dstat

Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 3.30466706 seconds 

Done. dstat is installed. 
$ rpm -q dstat
dstat-0.7.0-1.5.amzn1.noarch



No comments:

Post a Comment