Desired State Configuration for Linux

 

As you (may) know, Desired State Configuration for Linux is available since May 6 on the Microsoft Open Source github ! This version works like a charm alongside Windows Management Framework v5.

The goal of this post is to show you how it works and what you need in order to get it working. Everything here has been tested with the lastest version available:

Open Management Infrastructure

Open Management Infrastructure (OMI) is an OMI Open Source Project that permit to enable CIM/WBEM DMTF standards.

OMI’s primary goal is to provide a rich, high-performance, standards-based management stack that is suitable for a wide range of management applications. This includes cloud management, storage management, server hardware management, device management, and network management, on both large and small systems (embedded and mobility). To support this goal, OMI implements DMTF CIM/WBEM standards with the following characteristics: A very small footprint A provider generator model which makes the task of creating providers very easy High portability to a wide variety of hardware and software High performance Support for WS-Management OMI is an open source project to further the development of a production quality implementation of the DMTF CIM/WBEM standards. The OMI CIMOM is also designed to be portable and highly modular. In order to attain its small footprint, it is coded in C, which also makes it a much more viable CIM Object Manager for embedded systems and other infrastructure components that have memory constraints for their management processor. OMI is also designed to be inherently portable. It builds and runs today on most versions of UNIX(r) and Linux. In addition to OMI’s small footprint, it also demonstrates very high performance. At the technical level, the OMI Project operates on the principle of consensus-based decision making, with a light-weight process of approving code check-ins. The Project Management Committee recognizes merit among the community of technical contributors by granting individuals approval rights (Committers)

In other words when you install OMI on your linux box, you will be able to connect using a CIM Session on it using PowerShell Cmdlets !

OMI Installation

OMI installation is pretty simple. You can use the following lines in order to do this logged as root.

Local Configuration Manager

The Local Configuration Manager for Linux brings the same tools as on Windows. It means you can configure your server using PULL or PUSH DSC. Microsoft has done a great work porting it on Linux !

LCM Installation

Local Configuration Manager is pretty simple too, you can use the following lines in order to do this logged as root.

Connect using CIM Session

Our Linux has OMI installed and configured with LCM.The first thing to do is open the WSMan HTTPS port in firewall

Now let’s start the OMI Server,

If you want to run this in an active console, to troubleshoot, you could use this

Right now our omi server is running smoothly, but if it’ll start with the system it’d be better, no ?

Michael Green has posted a solution for this on his Technet blog. Open a vim editor in your console and save this script as /etc/init.d/omiserver

And now, we just have to regikster the script as a service.

Let’s now use PowerShell to build a CIM Session and connect to Local Configuration Manager 🙂

Now, you’re connected to the CIM Session, let’s confirm it works !

 Push DSC Configuration on Linux

As usual with DSC we’ll need resources for Linux, they are now available on github here. Once downloaded and unzipped. Put the nx resource in the same dire as usual C:\Program Files\WindowsPowerShell\Modules.

You can confirm that the resource is correctly imported using Get-DscResource and see it listed. This is not a scripted resource, but a binary one.

So let’s now start with a quick configuration.

Our MOF file is now available in C:\temp\MyDSCDemo 🙂

dsc_linux_02

Pull DSC Configuration on Linux

In order to make the LCM pull a configuration we have to configure it. To do this, this is EXACTLY the same process as in Windows.

 

Assuming you already have a pull Server on your network, let’s build a configuration and change it to a pulled one.

 

Ouf MOF file is created let’s move it to our Pull Server.

dsc_linux_03

And finally, configure the LCM in Pull mode.

dsc_linux_04

Let’s now force the PULL request

dsc_linux_05

The job will take 2-3 seconds to finish. Let’s verify everything is correctly applied !

dsc_linux_06

 

Ok it seems LCM is working on both Push & Pull mode! Very cool 🙂

If you have any questions, please ask in comments.

I want to thanks Bartek Bielawski for his help !

Regards,