forked from Tikam02/DevOps-Guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Tikam02#166 from rahulgore7/master
Chef Commands Added
- Loading branch information
Showing
1 changed file
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,99 @@ | ||
# Chef Commands | ||
### Install | ||
|
||
In your server: | ||
|
||
```bash | ||
$ sudo apt-get install curl | ||
|
||
``` | ||
|
||
```bash | ||
$ curl -L https://omnitruck.chef.io/install.sh | sudo bash | ||
Thank you for installing Chef! | ||
|
||
``` | ||
|
||
```bash | ||
$ chef-solo -v | ||
... | ||
Chef: 14.5.33 | ||
``` | ||
|
||
### Start the cookbook | ||
|
||
```bash | ||
wget http://github.com/chef-cookbooks/chef-repo/tarball/master -O - | tar xzf - --strip-components=1 | ||
|
||
``` | ||
|
||
### Knife | ||
|
||
```bash | ||
$ knife supermarket download mysql | ||
|
||
``` | ||
|
||
### Invoking chef-solo | ||
|
||
```bash | ||
$ chef-solo -c solo.rb -j web.json | ||
``` | ||
## [](https://devhints.io/chef#examples)Examples | ||
|
||
### Simple compile-from-source | ||
|
||
```ruby | ||
execute "tar --no-same-owner -zxf hi.tar.gz" do | ||
cwd "/usr/local/src" | ||
creates "/usr/local/src/node-v#{version}" | ||
end | ||
|
||
``` | ||
|
||
```ruby | ||
bash "compile" do | ||
cwd "/usr/local/src/node-v#{version}" | ||
code %[ | ||
PATH=/usr/local/bin:$PATH | ||
./configure | ||
make | ||
] | ||
creates "/usr/local/src/node-v#{version}/node" | ||
end | ||
``` | ||
### Execute | ||
|
||
```ruby | ||
execute "name" do | ||
cwd "..." | ||
environment({ "PATH" => "..." }) | ||
command "make install" | ||
creates "..." | ||
end | ||
``` | ||
### remote file | ||
|
||
```ruby | ||
remote_file "/usr/local/src/hi.tar.gz" do | ||
source "http://..." | ||
checksum "ab83be..." | ||
mode 0644 | ||
action :create_if_missing | ||
end | ||
``` | ||
|
||
### ruby_block | ||
|
||
```ruby | ||
ruby_block "name" do | ||
block { File.read ... } | ||
not_if { File.exists?(...) } | ||
end | ||
``` | ||
### Conditions | ||
|
||
```ruby | ||
creates "/usr/local/src/node-v#{version}/node" | ||
not_if { File.exists?('...') } | ||
``` | ||
|