How to install Samba Server and CIFS client on Linux with Chef

Configuring Samba server with Chef

Recently, I have automated the Samba server and CIFS client on centos with the help of Chef.

The Cookbook is, of course, available on super-market but in production, you are not allowed to copy someone else code.

If you are new or still in the learning phase, this blog will provide you the overview of the directory structure and how we are dealing with the various resources of Chef in production.

The first thing we will create is the Chef directories as below,

Now we will look one by one the configuration of files.


The above code is self-explanatory, no matter if you know Chef DSL or not.

For any kind of help with Chef, resources visit the link

Let’s look into the client side configurations.



{execute “changes_mount_dir_per” do — end } is not important you can skip.

Again the above code is pretty much easy to understand.


The above code is the configuration of samba which you will find after cheffing the server in “/etc/samba/” directory.



Roles, which can be assigned to multiple nodes which include the run_list with the recipe you want to run from particular cookbooks.



Nodes belong to particular server configurations which include Roles to run.

Ok, Now you can do the above stuff without Roles or Nodes but I have followed the standard approach which you can easily modify to multiple Cookbooks, Nodes, Roles.

Cooking the server with node

Login to the samba server and type the below command in a terminal you will see the client connected,

The same way login to your client server and verify the mount directory by creating files/folder.

That’s it for now, see you in the next useful blogs.

Developer: Nikhil raj
Price: Free

Leave a Reply