GithubHelp home page GithubHelp logo

cyberious / puppetlabs-dsc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puppetlabs-toy-chest/puppetlabs-dsc

0.0 1.0 0.0 4.78 MB

Puppet module for PowerShell Desired State Configuration (DSC) integration

License: Apache License 2.0

Ruby 44.33% HTML 9.99% PowerShell 45.54% Batchfile 0.03% Puppet 0.02% Shell 0.10%

puppetlabs-dsc's Introduction

Puppet PowerShell DSC Module

Overview

Puppet module for managing Windows poweshell DSC resources.

This module generates Puppet Types based on DSC resources MOF schema files.

In this version, the following DSC Resources are already built and ready for use:

This module is available on the Puppet Forge

Windows systems prerequisites

  • PowerShell 5 which is included in the Windows Management Framework 5.0. PowerShell v5 is currently in limited preview, so the above link may change after official release.

Installation on your puppet master

puppet module install puppetlabs-dsc

NOTE

When installing the module on Windows you may run into an issue regarding long file names (LFN), this is due to the generated schema files. If you are running in a master environment and installing the module on your master this will not be an issue, however if you are running masterless then you may run into this during installation depending on the length of the username it is ran from. One way to get around this is to download the .tar.gz and install using the file rather than directly from the forge. For more info see PUP-4866

Error: No such file or directory @ rb_sysopen - C:/ProgramData/PuppetLabs/puppet/cache/puppet-module/cache/tmp-unpacker20150713-...mof
Error: Try 'puppet help module install' for usage

Usage

You can use a DSC Resource by prefixing each DSC Resource name and parameter with 'dsc_'.

dsc_windowsfeature {'IIS':
  dsc_ensure => 'present',
  dsc_name   => 'Web-Server',
}

All DSC Resource names and parameters have to be in lowercase, e.g: dsc_windowsfeature or dsc_name.

Example

The following example class will install the 'Backery' website.

It's a real example and should also work for you.

class fourthcoffee(
  $websitename        = 'FourthCoffee',
  $zipname            = 'FourthCoffeeWebSiteContent.zip',
  $sourcerepo         = 'https://github.com/msutter/fourthcoffee/raw/master',
  $destinationpath    = 'C:\inetpub\FourthCoffee',
  $defaultwebsitepath = 'C:\inetpub\wwwroot',
  $zippath            = 'C:\tmp'
){

  $zipuri  = "${sourcerepo}/${zipname}"
  $zipfile = "${zippath}\\${zipname}"

  # Install the IIS role
  dsc_windowsfeature {'IIS':
    dsc_ensure => 'present',
    dsc_name   => 'Web-Server',
  } ->

  # Install the ASP .NET 4.5 role
  dsc_windowsfeature {'AspNet45':
    dsc_ensure => 'present',
    dsc_name   => 'Web-Asp-Net45',
  } ->

  # Stop an existing website (set up in Sample_xWebsite_Default)
  dsc_xwebsite {'Stop DefaultSite':
    dsc_ensure       => 'present',
    dsc_name         => 'Default Web Site',
    dsc_state        => 'Stopped',
    dsc_physicalpath => $defaultwebsitepath,
  } ->

  # Create tmp folder
  dsc_file {'tmp folder':
    dsc_ensure          => 'present',
    dsc_type            => 'Directory',
    dsc_destinationpath => $zippath,
  } ->

  # Download the site content
  dsc_xremotefile {'Download WebContent Zip':
    dsc_destinationpath => $zipfile,
    dsc_uri             => $zipuri,
  } ->

  # Extract the website content 
  dsc_archive {'Unzip and Copy the WebContent':
    dsc_ensure      => 'present',
    dsc_path        => $zipfile,
    dsc_destination => $destinationpath,
  } ->

  # Create a new Website
  dsc_xwebsite {'BackeryWebSite':
    dsc_ensure       => 'present',
    dsc_name         => $websitename,
    dsc_state        => 'Started',
    dsc_physicalpath => $destinationpath,
  }
}

As you can see, you can mix and match dsc resources with common puppet resources. All puppet metaparameters should also be supported.

Limitations

  • DSC Composite Resources are not yet fully supported.
  • PSObjects like 'PSCredential' as parameters value not yet supported.

Notes

The puppet types are built from the source code of each DSC Resources MOF schema files.
If you want the build Puppet types for your own custom DSC Resources, read the README_BUILD

License

Copyright (c) 2014 Marc Sutter, original author
Copyright (c) 2015 Puppet Labs
License: Apache License, Version 2.0

puppetlabs-dsc's People

Contributors

iristyle avatar ferventcoder avatar zreichert avatar jpogran avatar msutter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.