On the workstation we install knife or chefdk.
On the node,we install chef-client(i.e agent software).
These nodes are pulling the information from the chef
server,this model of chef configuration is called as the pull model
configuration.
If server says,I have something new,if it pushes to the
nodes then it is called as push model.
Puppet are push models
Where as ansible and salt are pull models .
Every model has its pros and cons.
Now here,we develop some scripts:
Whatever we write individually we called it as recipe.
And we combine recipes to form cookbooks.
Note: We never upload recipes,we upload the cookbooks.
The cookbook will be uploaded from workstation to the
server.
And this cookbook we sent with some additional data to your
production server and your server will do compilation.
Where does the compilation happen?
The compilation will happen on the node.
Note:In puppet server
compile the scripts and send it.
Where does in the
chef,it does not compile script,it justs sends the script.
Whatever we write in recipe,to make it work,we need ruby.
So internally when you install the chef,you get ruby
obviously.
Even though your having different version of ruby,chef will
have its own version of ruby.
Underneath everything,it is ruby that is making our work.
Incase of chef and
puppet,ruby is taking care of that.
Incase of ansible,python will does this work.
Certain
restrictions,that we need to remember:
The chef server
should be a linux server.
Your workstation can
be a windows and node also can be a windows.
There are two
flavours of server:
Hosted chef (easy to setup).
Onpremises chef
Creating two machines:
One for my local workstation.
One for my node.
Linux supports a protocol SSH.(secure shell is a way of
connecting to the windows shell).
Ssh will not be find in the windows.
(you need to install,some secure shell client).the best
client is:
GIT for windows. (if you use the windows machine).
double click on that and click next,until it says finish.
Note:don’t change the configuration.
Accept the agreement.
After that,click anywhere on the Desktop
we downloaded the pem,go to that pem file and right click on
the key and just say Git bash here.
Just select the machine,which you want to connect.
paste that ssh command on the Git bash.
Once you done this,you can able to login to the linux
machine
Login as a sudo user:
$ Sudo –i
As this is the Ubuntu,I need to update the packages on the
Ubuntu server.
We have to this for another machine also.
We need to start
installing the components that is required for the CHEF
When you install Git bash,you no need to install the putty and the WinSCP.
Previously,knife is
the only client tool.
Now,we have the chefDk another client tool.
There are many tools,but they developed Chefdk.
If you go to a company and asked to work on earlier versions
of the chef,there will be a lot of difference in the knife and how you work on
the chefdk.
Now,we are starting with the knife:
Note:In chefdk
also,we use the knife,but we wont use
knife for everything.
Incase of earlier version ,we use to use knife for everything.
we have to install this command on the workstation machine.
Once,this is done,we
have to install the knife:
# knife –v
My workstation is
ready now.(this is with the older version).
Note:
Node list should be
empty
Administartion > A starter kit should be downloaded.
(starter kit is a folder,which contains certain details about
the server).
Click on the organsation
> go to action there > we can see the starter kit.
we have to tell about our server to the workstation.
(with the above steps,we just installed the knife(which is
required for the chef-client)).
There should be some place,where you tell chef,this is your
server (i.e chef server).
That some place,which
is nothing but the starter kit.
The first thing is
the download the starterkit:
you downloaded the
starterkit on to the machine:
chefstarter kit
> chef-repo >
.chef > we have the .pem key and knife.rb
Can you see any url inside the knife.rb?
Yes,we can see the chef server url,related to our organsation
chef server Url.
Basically,this file
Will tell your knife,this is your server.
You should be presented this,whenever you do any action.
Note:
The first thing,you have to do after installing the
workstation is,downloading the starter kit.
And in the node,the installation has to be done.software
component called as a chef-client.
And this chef-client need to know about the server.
Remember in the chef workflow,the only place,where your workstation
will directly access the node is to establish this connection.
On our node,there should be a software should be installed
that is the chef-client.
And chef-client should have the information about your
server.
And this process is called as Bootstrapping
Installing the chef client component on the server and
trying to establish,connection between your node and chef server.
Node --to
establish connection---------------Ã
chef server (this process is called the
bootstrapping).
(for this,we are installing the chef-client and establishing
the connection).
(this is the only time in the chef lifecycle,where it
directly trys to connect to the node).
There will be no other scenarios (related to the
connection).
First and foremost,we
have downloaded the starter kit in the local machine.
We have to use the
scp commands to copy (which is scp).
I copied the
chef-repo to the workstation (from my local machine to the workstation (linux
server)).
we need to copy the
key also on to the (workstation server).
Copying the key from
the local machine to the workstation:
/home/Ubuntu >>> this is the folder we have everything.
Now, I should be able
to bootstrap the nodes.
Always we have to use
the public ipaddress,because our chef server is not a part our organsation
network,so because of that reason we us the public ipaddress.
Note:
If it is outside the
chef-repo,it is unable to find the chef-server information.
During convergence:
Chef node will
communicate and will ask about the updated policies present on the chef server.
To ask that,it will
execute this command:
$ chef-client
No comments:
Post a Comment