GithubHelp home page GithubHelp logo

jeffmccune / puppetlabs-registry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puppetlabs/puppetlabs-registry

1.0 48.0 0.0 312 KB

Puppet Module to provide Windows Registry Types and Providers

Home Page: http://projects.puppetlabs.com/projects/modules

Puppet 19.91% Ruby 80.09%

puppetlabs-registry's Introduction

Windows Registry Module

This module provides the types and providers necessary to manage the Windows Registry with Puppet.

Installation

The best way to install this module is with the puppet module subcommand or the puppet-module Gem. On your puppet master, execute the following command, optionally specifying your puppet master's modulepath in which to install the module:

$ puppet module install [--modulepath <path>] puppetlabs-registry

See the section Installing Modules for more information.

Make sure your puppet agent is configured to synchronize plugins using the setting:

[main]
pluginsync = true

This is the default behavior of the Puppet Agent on Microsoft Windows platforms. This setting will ensure the types and providers are synchronized and available on the agent before the configuration run takes place.

Installation from source

If you'd like to install this module from source, please simply clone a copy into your puppet master's modulepath. Here is an example of how to do so for Puppet Enterprise:

$ cd /etc/puppetlabs/puppet/modules
$ git clone git://github.com/puppetlabs/puppetlabs-registry.git registry

Examples

The registry_key and registry_value types are provided by this module.

registry_key { 'HKLM\System\CurrentControlSet\Services\Puppet':
  ensure => present,
}
registry_value { 'HKLM\System\CurrentControlSet\Services\Puppet\Description':
  ensure => present,
  type   => string,
  data   => "The Puppet Agent service periodically manages your configuration",
}

The registry::value defined resource type provides a convenient way to manage values and the parent key:

registry::value { 'MyApp Setting1':
  key   => 'HKLM\Software\Vendor\PuppetLabs',
  value => setting1,
  data  => 'Hello World!'
}

With this single resource declaration both the registry_key of HKLM\Software\Vendor\PuppetLabs and the registry_value of HKLM\Software\Vendor\PuppetLabs\setting will be managed.

The registry::value defined type only managed keys and values in the system native architecture. That is to say, the 32 bit keys won't be managed by this defined type on a 64 bit OS.

Purge Values Example

If you want to make sure only the values specified in Puppet are associated with a particular key, you can use the purge_values => true parameter of the registry_key resource to delete any values not explicitly managed by Puppet. The registry::example_purge class shows how this is accomplished:

Make sure the registry::example_purge class is included in the node catalog, then setup a registry key that contains six values:

PS C:\> $env:FACTER_PURGE_EXAMPLE_MODE = 'setup'
PS C:\> puppet agent --test
notice: /Stage[main]/Registry::Purge_example/Registry_key[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value3]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value2]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_key[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\SubKey]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value5]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value6]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\SubKey\Value1]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value1]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\SubKey\Value2]/ensure: created
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value4]/ensure: created
notice: Finished catalog run in 0.14 seconds

Switching the mode to 'purge' will cause the class to only manage three of the six registry_value resources. The other three will be purged since the registry_key resource has purge_values => true specified in the manifest. Notice how Value4, Value5 and Value6 are being removed.

PS C:\> $env:FACTER_PURGE_EXAMPLE_MODE = 'purge'
PS C:\> puppet agent --test
notice: /Registry_value[hklm\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value4]/ensure: removed
notice: /Registry_value[hklm\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value6]/ensure: removed
notice: /Registry_value[hklm\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value5]/ensure: removed
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value3]/data: data changed 'key3' to 'should not be purged'
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value2]/data: data changed '2' to '0'
notice: /Stage[main]/Registry::Purge_example/Registry_value[HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge\Value1]/data: data changed '1' to '0'
notice: Finished catalog run in 0.16 seconds

License

Apache License, Version 2.0

Contact

Support

Please log tickets and issues at our Module Issue Tracker.

Known Issues

Please refer to the current list of known registry issues.

EOF

puppetlabs-registry's People

Contributors

joshcooper avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.