annotation

pdk
Add annotation metaparameter to document purpose, owner, or other metadata elements of any resource.
reidmv

reidmv

reidmv

658 downloads

644 latest version

5.0 quality score

Version information

  • 0.1.1 (latest)
  • 0.1.0
released May 14th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    windows
    ,
    Solaris
    ,
    SLES
    ,
    Darwin
    ,
    Fedora

Start using this module

Documentation

reidmv/annotation — version 0.1.1 May 14th 2020

annotation

Description

This module adds an extra Puppet metaparameter for the purpose of recording high-level or human-readable annotations about what classes or resources are for. This information can be used to automatically generate human-readable reports either of what work Puppet has performed on a system or of all the content Puppet is managing on a system, and why.

Usage

Put this in site.pp to enable annotation

annotation::enable()

Use the annotation metaparameter as needed on resources

notify { 'example':
  message    => 'this is a notify resource',
  annotation => 'this is an annotation for it',
}

file { '/tmp/example.conf':
  ensure     => file,
  owner      => 'root',
  annotation => {
    'description' => 'Annotations do not need to be strings',
    'product'     => 'Example Product',
    'owner'       => 'Kelly',
  },
}

To annotate classes, either declare them resource-style, or use the annotation() function. Note that the two methods of annotating are mutually exclusive.

class example {
  annotation('This is an annotation declared IN the example class')
}

An annotation set in a resource-style class parameter declaration will override the annotation set using annotation() inside the class.

class { 'example':
  annotation => 'This annotation will override the other one',
}

Querying

To query for all annotated resources on a node, use a PuppetDB PQL query such as the following.

resources { certname = "example.node.tld" and parameters.annotation is not null }