registry
Version information
Start using this module
Add this module to your Puppetfile:
mod 'puppetlabs-registry', '0.1.0'
Learn more about managing modules with a PuppetfileDocumentation
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
Contact
- Puppet Labs support@puppetlabs.com
- Jeff McCune jeff@puppetlabs.com
- Josh Cooper josh@puppetlabs.com
Support
Please log tickets and issues at our Module Issue Tracker.
Known Issues
Please refer to the current list of known registry issues.
EOF
Types in this module release
2012-05-16 - Jeff McCune jeff@puppetlabs.com
- (#14529) Add registry::value defined type (bf44208)
2012-05-16 - Josh Cooper josh+github@puppetlabs.com
- Update README.markdown (2e9e45e)
2012-05-16 - Josh Cooper josh+github@puppetlabs.com
- Update README.markdown (3904838)
2012-05-15 - Josh Cooper josh@puppetlabs.com
- (Maint) Add type documentation (82205ad)
2012-05-15 - Josh Cooper josh+github@puppetlabs.com
- Remove note about case-sensitivity, as that is no longer an issue (5440a0e)
2012-05-15 - Jeff McCune jeff@puppetlabs.com
- (#14501) Fix autorequire case sensitivity (d5c12f0)
2012-05-15 - Jeff McCune jeff@puppetlabs.com
- (maint) Remove RegistryKeyPath#{valuename,default?} methods (29db478)
2012-05-14 - Jeff McCune jeff@puppetlabs.com
- Add acceptance tests for registry_value provider (6285f4a)
2012-05-14 - Jeff McCune jeff@puppetlabs.com
- Eliminate RegistryPathBas#(default?,valuename) from base class (2234f96)
2012-05-14 - Jeff McCune jeff@puppetlabs.com
- Memoize the filter_path method for performance (6139b7d)
2012-05-11 - Jeff McCune jeff@puppetlabs.com
- Add Registry_key ensure => absent and purge_values coverage (cfd3789)
2012-05-11 - Jeff McCune jeff@puppetlabs.com
- Fix cannot alias error when managing 32 and 64 bit versions of a key (3a2f260)
2012-05-11 - Jeff McCune jeff@puppetlabs.com
- Add registry_key creation acceptance test (0e68654)
2012-05-09 - Jeff McCune jeff@puppetlabs.com
- Add acceptance tests for the registry type (0a01b11)
2012-05-08 - Jeff McCune jeff@puppetlabs.com
- Update type description strings (c69bf2d)
2012-05-05 - Jeff McCune jeff@puppetlabs.com
- Separate the implementation of the type and provider (4e06ae5)
2012-05-04 - Jeff McCune jeff@puppetlabs.com
- Add watchr script to automatically run tests (d5bce2d)
2012-05-04 - Jeff McCune jeff@puppetlabs.com
- Add registry::compliance_example class to test compliance (0aa8a68)
2012-05-03 - Jeff McCune jeff@puppetlabs.com
- Allow values associated with a registry key to be purged (27eaee3)
2012-05-01 - Jeff McCune jeff@puppetlabs.com
- Update README with info about the types provided (b9b2d11)
2012-04-30 - Jeff McCune jeff@puppetlabs.com
- Add registry::service defined resource example (57c5b59)
2012-04-25 - Jeff McCune jeff@puppetlabs.com
- Add REG_MULTI_SZ (type => array) implementation (1b17c6f)
2012-04-26 - Jeff McCune jeff@puppetlabs.com
- Work around #3947, #4248, #14073; load our utility code (a8d9402)
2012-04-24 - Josh Cooper josh@puppetlabs.com
- Handle binary registry values (4353642)
2012-04-24 - Josh Cooper josh@puppetlabs.com
- Fix puppet resource registry_key (f736cff)
2012-04-23 - Josh Cooper josh@puppetlabs.com
- Registry keys and values were autorequiring all ancestors (0de7a0a)
2012-04-24 - Jeff McCune jeff@puppetlabs.com
- Add examples of current registry key and value types (bb7e4f4)
2012-04-23 - Josh Cooper josh@puppetlabs.com
- Add the ability to manage 32 and 64-bit keys/values (9a16a9b)
2012-04-23 - Josh Cooper josh@puppetlabs.com
- Remove rspec deprecation warning (94063d5)
2012-04-23 - Josh Cooper josh@puppetlabs.com
- Rename registry-specific util code (cd2aaa1)
2012-04-20 - Josh Cooper josh@puppetlabs.com
- Fix autorequiring when using different root key forms (b7a1c39)
2012-04-19 - Josh Cooper josh@puppetlabs.com
- Refactor key and value paths (74ebc80)
2012-04-19 - Josh Cooper josh@puppetlabs.com
- Encode default-ness in the registry path (64bba67)
2012-04-19 - Josh Cooper josh@puppetlabs.com
- Better validation and testing of key paths (d05d1e6)
2012-04-19 - Josh Cooper josh@puppetlabs.com
- Maint: Remove more crlf line endings (e9f00c1)
2012-04-19 - Josh Cooper josh@puppetlabs.com
- Maint: remove windows cr line endings (0138a1d)
2012-04-18 - Josh Cooper josh@puppetlabs.com
- Rename
default
parameter (f45af86)
2012-04-18 - Josh Cooper josh@puppetlabs.com
- Fix modifying existing registry values (d06be98)
2012-04-18 - Josh Cooper josh@puppetlabs.com
- Remove debugging (8601e92)
2012-04-18 - Josh Cooper josh@puppetlabs.com
- Always split the path (de66832)
2012-04-18 - Josh Cooper josh@puppetlabs.com
- Initial registry key and value types and providers (065d43d)
Dependencies
- puppetlabs/stdlib (>= 2.3.0)