Forge Home

snd

Module to search a string within a file. If found, either display a message, or remove it.

5,977 downloads

5,349 latest version

4.6 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.1.2 (latest)
  • 0.1.1
  • 0.1.0
released Aug 7th 2017
This version is compatible with:

Start using this module

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

Add this module to your Puppetfile:

mod 'steroidg-snd', '0.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add steroidg-snd
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install steroidg-snd --version 0.1.2

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

steroidg/snd — version 0.1.2 Aug 7th 2017

snd (search and destroy)

Table of Contents

  1. Description
  2. Setup
  3. Usage
  4. Reference
  5. Limitations
  6. Development

Description

This snd (search and destroy) module can be used to search a string within a file and perform 2 types of actions if found:

  • Return true so puppet registers an action has been performed (default).
  • Delete the file.

This module can be used to detect problems in a file where deleting it is the easiest fix. I mainly use it for files automatically generated by other programs. By example DUID file for DHCPv6 clients.

Setup

What snd affects

The snd module only affects file(s) if specified.

Beginning with snd

There are 2 ways you can obtain this module.

Usage

You can use the module by including it:

include snd

Doing so won't have any effect until data hash is provided via hiera in the following format:

snd::params::search_items:
  [file_name]:
    search_str: '[search_string]'
    display_only: true/false

By example, to delete the file /tmp/foo if a line contains a line with 'answer is 42':

snd::params::search_items:
  /tmp/foo:
    search_str: '^answer is 42$'
    display_only: false

Reference

The reference of this module can be generated by puppet strings. There are 3 ways you can access the content:

  • Refer it in the official documentation.
  • Git checkout the gh-pages branch of the module repository.
  • Re-generate the reference locally by running puppet strings within the module directory.

Limitations

This module is tested on Ubuntu LTS against Puppet 5, but it'll probably work on other Linux distributions.

Development

Please feel free to clone, use, play, comment and create pull requests. Let's see how it goes.