Forge Home

manageonce

Sometimes you only want to manage a resource one time. This will help you do that.

7,383 downloads

7,383 latest version

3.3 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.0.1 (latest)
released Jun 20th 2016

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'binford2k-manageonce', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add binford2k-manageonce
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install binford2k-manageonce --version 0.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

binford2k/manageonce — version 0.0.1 Jun 20th 2016

manageonce

Table of Contents

  1. Overview
  2. Usage - Configuration options and additional functionality
  3. Limitations - OS compatibility, etc.
  4. 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.

Contact

binford2k@gmail.com