Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

datacentred/datacentred-runonce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 `/etc/puppetlabs/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

About

Utility class for handling exec's in puppet

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages