manageonce
Version information
Start using this module
Add this module to your Puppetfile:
mod 'binford2k-manageonce', '0.0.1'
Learn more about managing modules with a PuppetfileDocumentation
manageonce
Table of Contents
- Overview
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
I'll bet that at one time or another, you've wanted the ability to manage certain resources on a node--but only once. For example, you may want to manage user accounts with a defined initial password, but give your users the ability to update their password.
Usage
It's very simple. Just add the word manageonce
before your resource declaration
and it will only be managed one time. This will currently work for file
and
user
resource types only.
manageonce::file { '/root/.bashrc':
owner => 'root',
group => 'root,
mode => '0644,
content => file('mymod/bashrc'),
}
Alternatively, you can declare any resource type by using the manageonce
type:
manageonce { "puppet master host entry":
resourcetype => 'host',
resourcetitle => 'master.puppetlabs.vm',
parameters => { 'ip => 172.16.196.157', 'aliases' => ['puppet, master'] }
}
Finally, if you'd like to continue managing the resource, except for a certain
parameter or two, then you can pass an array of parameter names as $onlyonce
.
Any parameters in that list will be managed one time only.
manageonce::user { 'joe':
ensure => present,
password => hiera('defaults::user::initialpassword'),
onlyonce => ['password'],
}
Limitations
This will currently only run on Unix-like platforms due to the hard-coded path
for the external facts.d
directory.
Disclaimer
I take no liability for the use of this module. As this uses standard Ruby, the only reason that it won't work anywhere Puppet itself does is that it's got a hard-coded path. (TODO: fix this!)
I have not yet validated on anything other than CentOS.