Header Ads


PowerShell DSC on Linux--Part2

Installing DSC

DSC installable package is available for Linux and you can Download that is appropriate for your Linux system. You can download .rpm or .deb as per your Linux flavor.

.rpm Packages are install on CentOS, Red Hat Enterprise Linux, SUSE Linux Enterprise Server, and Oracle Linux and .dbe packages are install on Debian GNU/Linux and Ubuntu Server.

Opem SSL Version (ssl_098 or ssl_100), and architecture (X64/X86). The ssl_098 packages are appropriate for computer with openSSL 0.9.8 install while the ssl_100 packages are appropriate for computers with OpenSSL 1.0 installed.

To know installed OpenSSL version, run the command “openssl version”

sudo rpm -Uvh dsc-1.0.0-254.ssl_100.x64.rpm

Follow below steps to create and run DSC configuration on Linux system

Creating a configuration MOF

Following steps will explain how to create configuration for Linux system, configuration commands are same like windows.

Import nx module, this module holds the schema default DSC resources for Linux and same must install on your local system and import in configuration, just like below.

Before importing nx moduel, copy the nx module directory to following location

USERPROFILE\Documents\WindowsPowerShell\Modules\ or PShome\Modules

You can use "Import-DSCResource" command to import module in configuration. please user following config code.

Configuration LinuxConfiguration{

    Import-DSCResource -Module nx

Generate the configuration

Configuration LinuxConfiguration{

    Import-DscResource -Module nx

    Node  "LX-01.test.lab"{
    nxFile ExampleFile {

        DestinationPath = "/tmp/example"
        Contents = "hello"
        Ensure = "Present"
        Type = "File"

LinuxConfiguration -OutputPath:"C:\LX-Config"

No comments:

Systemadminworld. Powered by Blogger.