Day 72: Deploying the SCCM 2012 R2 Client to Linux using Chef

If you have been following along with the Chef related articles, you may remember that the last Chef post was on Day 62, Deploying your Windows Recipe from your Chef Server. Today, we will be going over a Chef Recipe for deploying the SCCM 2012 R2 Client to an Ubuntu Server 12.04.

 

Prerequisites

Before we start, we need to install the Chef Development Kit on our Chef Workstation running Ubuntu.

From the Chef Workstation run the following command to download the package

 

Next, install the package by running the following command

 

Next, you need to place the SCCM 2012 R2 Client for Additional Operating Systems files into a web accessible share; i.e. – you need to be able to retrieve the them using wget. In order for the recipe below to work for Ubuntu Server 12.04, the two files listed below are required from the download above.

 

Whether you decide to go with a Windows or Linux based solution for hosting the SCCM Client Files, make sure that you can retrieve the files using wget from your Chef Workstation running Ubuntu. An example for using wget is shown below.

 

 

 

 

 

Setting up the SCCM Cookbook and Recipe

Now that the Chef Development Kit is installed on the Chef Workstation, we can create the SCCM Cookbook and Recipe.

First, cd to the cookbooks directory located in your chef-repo directory on your Chef Workstation.

 

Next, generate a new cookbook called SCCM_2012_R2_Client_Ubuntu.

 

Next, open up the default.rb located in the recipes directory in the new cookbook using the vim editor.

 

Paste in the recipe below into the default.rb file.

This recipe does the following four actions:

1. Downloads the SCCM Client tarball for Ubuntu
2. Downloads the install file used to deploy the SCCM Client and makes the file executable
3. Install the SCCM Agent.
4. Starts the SCCM Agent.

Additionally, the following checks are made during the download of the SCCM Client Files and during the SCCM Client Install.

 

 

Take note of the following variable values at the top of the recipe and fill them in with their respective values.

 

 

Sample values for each of the three variables is shown below.

 

Once you have finished making changes to the default.rb file, save your changes and close the file.

Next,manually run the chef recipe on the Chef Workstation to verify that it is working correctly.

 

If all ran accordingly, you should see something similar in your putty session as shown below

Successful SCCM Client Install using Chef

 

Next, you can verify that the Chef Ubuntu Workstation is now reporting into your SCCM Environment by checking the SCCM Console. Additionally, you can verify that the Client Service is running on the Chef Ubuntu Workstation by running the following command

 

You should back something similar to what is shown below

 

Once you have verified that the recipe is working as intended, upload the cookbook to your Chef Server to deploy to other Ubuntu Servers in your Environment.

 

Remember, you can assign the cookbook to other hosts using the Chef Server Web UI or by running the following command from the Chef Ubuntu Workstation

 

 

 

Conclusion

This week’s post has demonstrated how to deploy the SCCM 2012 R2 Client to Ubuntu Server 12.04 using Chef.

 

Previous Installments

100 Days of DevOps with PowerShell

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.