Skip to main content

Posts

Showing posts with the label cookbook

Chef: Overview

Chef is a powerful automation platform that transforms infrastructure into code. Whether you’re operating in the cloud, on-premises, or in a hybrid environment, Chef automates how infrastructure is configured, deployed, and managed across your network, no matter its size. This diagram shows how you develop, test, and deploy your Chef code. The workstation is the location from which users interact with Chef. On the workstation users author and test  cookbooks  using tools such as  Test Kitchen  and interact with the Chef server using the  knife  and  chef command line tools. Nodes are the machines—physical, virtual, cloud, and so on—that are under management by Chef. The chef-client is installed on each node and is what  performs the automation on that machine . Use the Chef server as your foundation to create and manage flexible, dynamic infrastructure whether you manage 50 or 500,000 nodes, across multiple datacenters, public and private clouds, and in heterogeneous environments...

Chef: Test Kitchen

Install docker with the following command: yum install docker systemctl start docker Then we need to install the kitchen-docker ruby gem. chef gem install kitchen-docker Create a cookbook: chef generate cookbook my_cookbook Edit the .kitchen.yml file in the generated cookbook. Change the driver name from vagrant to docker and delete the line - name: centos-7 Save and close. Then execute kitchen converge . This command will create a docker container for us and put all the settings in place. The output will be something as follows: Synchronizing Cookbooks: - my_cookbook (0.1.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 0 resourcesRunning handlers: Running handlers complete Chef Client finished, 0/0 resources updated in 18 seconds Finished converging <default-ubuntu-1604> (7m3.52s). Then run kitchen list The output will be something as follows: Instance Driver Provisioner Verifier Transport Last Action Last Error default-ubuntu-1604 Docker ChefZero Ins...

Install and configure chef server on centos 7

Go to this link: https://downloads.chef.io/chef-server In the on-premise section select your OS and download your package. Here I will be using centos 7. When the rpm is downloaded you can install it via the command: sudo rpm -Uvh Execute the following command: chef-server-ctl reconfigure Because the Chef server is composed of many different services that work together to create a functioning system, this step may take a few minutes to complete. Run the following command to create an administrator: $ chef-server-ctl user-create USER_NAME FIRST_NAME LAST_NAME EMAIL 'PASSWORD' --filename FILE_NAME An RSA private key is generated automatically. This is the user’s private key and should be saved to a safe location. The  --filename  option will save the RSA private key to the specified absolute path. For example: $ chef-server-ctl user-create stevedanno Steve Danno steved@chef.io 'abc123' --filename /path/to/stevedanno.pem If you get the following err...