runonce

contributions requested
Module to execute commands once

13,399 downloads

13,399 latest version

3.9 quality score

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

  • 1.0.0 (latest)
released Sep 19th 2014

Start using this module

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

Add this module to your Puppetfile:

mod 'datacentred-runonce', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add datacentred-runonce
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install datacentred-runonce --version 1.0.0

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

datacentred/runonce — version 1.0.0 Sep 19th 2014

#Run Once

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Testing - Guide for contributing to the module

Overview

The run once module is a wrapper around exec. It ensures that a command is only ever executed once without having to explitily specifying $onlyif or $unless parameters.

##Module Description

The underlying implmentation uses semaphore lock files to control whether or not to run a command. An optional semaphore directory is created if it did not already exist, the command executed and the semaphore created upon success. Semaphores can either be persistent, by default residing in /var/lib/puppet/semaphores, or transient, residing in /tmp, and thus the command will be executed once per reboot.

Usage

runonce { 'hello-world':
  command => 'echo hello world!',
}

runonce { 'init-modules':
  command    => 'service kmod start',
  persistent => false,
}

Limitations

The current implmentation relies on /tmp being cleared by the underlying operating system on a reboot. Aditionally the persistent semaphore directory does not support parent directory creation.

Testing

This has been tested on Ubuntu LTS 12.04 and 14.04