• Stars
    star
    350
  • Rank 121,229 (Top 3 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 13 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Puppet Labs Standard Library module

stdlib

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Reference
    1. Data Types
    2. Facts
  6. Limitations
  7. Development
  8. Contributors

Overview

This module provides a standard library of resources for Puppet modules.

Module Description

Puppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:

  • Stages
  • Facts
  • Functions
  • Defined types
  • Data types
  • Providers

Note: As of version 3.7, Puppet Enterprise no longer includes the stdlib module. If you're running Puppet Enterprise, you should install the most recent release of stdlib for compatibility with Puppet modules.

Setup

Install the stdlib module to add the functions, facts, and resources of this standard library to Puppet.

If you are authoring a module that depends on stdlib, be sure to specify dependencies in your metadata.json.

Usage

Most of stdlib's features are automatically loaded by Puppet. To use standardized run stages in Puppet, declare this class in your manifest with include stdlib.

When declared, stdlib declares all other classes in the module. This currently consists of stdlib::manage and stdlib::stages.

The stdlib::stages class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):

  • setup
  • main
  • runtime
  • setup_infra
  • deploy_infra
  • setup_app
  • deploy_app
  • deploy

Sample usage:

node default {
  include stdlib
  class { java: stage => 'runtime' }
}

The stdlib::manage class provides an interface for generating trivial resource declarations via the create_resources parameter. Depending on your usage, you may want to set hiera's lookup_options for the stdlib::manage::create_resources: element.

---
stdlib::manage::create_resources:
  file:
    /etc/somefile:
      ensure: file
      owner: root
      group: root
  package:
    badpackage:
      ensure: absent

Reference

For information on the classes and types, see the REFERENCE.md.

Data types

Stdlib::Absolutepath

A strict absolute path type. Uses a variant of Unixpath and Windowspath types.

Acceptable input examples:

/var/log
/usr2/username/bin:/usr/local/bin:/usr/bin:.
C:\\WINDOWS\\System32

Unacceptable input example:

../relative_path

Stdlib::Ensure::Service

Matches acceptable ensure values for service resources.

Acceptable input examples:

stopped
running

Unacceptable input example:

true
false

Stdlib::HTTPSUrl

Matches HTTPS URLs. It is a case insensitive match.

Acceptable input example:

https://hello.com

HTTPS://HELLO.COM

Unacceptable input example:

httds://notquiteright.org`

Stdlib::HTTPUrl

Matches both HTTPS and HTTP URLs. It is a case insensitive match.

Acceptable input example:

https://hello.com

http://hello.com

HTTP://HELLO.COM

Unacceptable input example:

httds://notquiteright.org

Stdlib::MAC

Matches MAC addresses defined in RFC5342.

Stdlib::Unixpath

Matches absolute paths on Unix operating systems.

Acceptable input example:

/usr2/username/bin:/usr/local/bin:/usr/bin:

/var/tmp

Unacceptable input example:

C:/whatever

some/path

../some/other/path

Stdlib::Filemode

Matches octal file modes consisting of one to four numbers and symbolic file modes.

Acceptable input examples:

0644
1777
a=Xr,g=w

Unacceptable input examples:

x=r,a=wx
0999

Stdlib::Windowspath

Matches paths on Windows operating systems.

Acceptable input example:

C:\\WINDOWS\\System32

C:\\

\\\\host\\windows

Valid values: A windows filepath.

Stdlib::Filesource

Matches paths valid values for the source parameter of the Puppet file type.

Acceptable input example:

http://example.com

https://example.com

file:///hello/bla

Valid values: A filepath.

Stdlib::Fqdn

Matches paths on fully qualified domain name.

Acceptable input example:

localhost

example.com

www.example.com

Valid values: Domain name of a server.

Stdlib::Host

Matches a valid host which could be a valid ipv4, ipv6 or fqdn.

Acceptable input example:

localhost

www.example.com

192.0.2.1

Valid values: An IP address or domain name.

Stdlib::Port

Matches a valid TCP/UDP Port number.

Acceptable input examples:

80

443

65000

Valid values: An Integer.

Stdlib::Port::Privileged

Matches a valid TCP/UDP Privileged port i.e. < 1024.

Acceptable input examples:

80

443

1023

Valid values: A number less than 1024.

Stdlib::Port::Unprivileged

Matches a valid TCP/UDP Privileged port i.e. >= 1024.

Acceptable input examples:

1024

1337

65000

Valid values: A number more than or equal to 1024.

Stdlib::Base32

Matches paths a valid base32 string.

Acceptable input example:

ASDASDDASD3453453

asdasddasd3453453=

ASDASDDASD3453453==

Valid values: A base32 string.

Stdlib::Base64

Matches paths a valid base64 string.

Acceptable input example:

asdasdASDSADA342386832/746+=

asdasdASDSADA34238683274/6+

asdasdASDSADA3423868327/46+==

Valid values: A base64 string.

Stdlib::Ipv4

This type is no longer available. To make use of this functionality, use Stdlib::IP::Address::V4.

Stdlib::Ipv6

This type is no longer available. To make use of this functionality, use Stdlib::IP::Address::V6.

Stdlib::Ip_address

This type is no longer available. To make use of this functionality, use Stdlib::IP::Address

Stdlib::IP::Address

Matches any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses.

Examples:

'127.0.0.1' =~ Stdlib::IP::Address                                # true
'10.1.240.4/24' =~ Stdlib::IP::Address                            # true
'52.10.10.141' =~ Stdlib::IP::Address                             # true
'192.168.1' =~ Stdlib::IP::Address                                # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address  # true
'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address                     # true

Stdlib::IP::Address::V4

Match any string consisting of an IPv4 address in the quad-dotted decimal format, with or without a CIDR prefix. It will not match any abbreviated form (for example, 192.168.1) because these are poorly documented and inconsistently supported.

Examples:

'127.0.0.1' =~ Stdlib::IP::Address::V4                                # true
'10.1.240.4/24' =~ Stdlib::IP::Address::V4                            # true
'192.168.1' =~ Stdlib::IP::Address::V4                                # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4  # false
'12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4                   # false

Valid values: An IPv4 address.

Stdlib::IP::Address::V6

Match any string consisting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.

Examples:

'127.0.0.1' =~ Stdlib::IP::Address::V6                                # false
'10.1.240.4/24' =~ Stdlib::IP::Address::V6                            # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6  # true
'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6                     # true
'FF01::101' =~ Stdlib::IP::Address::V6                                # true

Valid values: An IPv6 address.

Stdlib::IP::Address::Nosubnet

Match the same things as the Stdlib::IP::Address alias, except it will not match an address that includes an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').

Valid values: An IP address with no subnet.

Stdlib::IP::Address::V4::CIDR

Match an IPv4 address in the CIDR format. It will only match if the address contains an address prefix (for example, it will match '192.168.0.6/24' but not '192.168.0.6').

Valid values: An IPv4 address with a CIDR provided eg: '192.186.8.101/105'. This will match anything inclusive of '192.186.8.101' to '192.168.8.105'.

Stdlib::IP::Address::V4::Nosubnet

Match an IPv4 address only if the address does not contain an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').

Valid values: An IPv4 address with no subnet.

Stdlib::IP::Address::V6::Full

Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of RFC 2373, with or without an address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::Alternate

Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will match addresses with or without an address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::Compressed

Match an IPv6 address which may contain :: used to compress zeros as documented in section 2.2.2 of RFC 2373. It will match addresses with or without an address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::Nosubnet

Alias to allow Stdlib::IP::Address::V6::Nosubnet::Full, Stdlib::IP::Address::V6::Nosubnet::Alternate and Stdlib::IP::Address::V6::Nosubnet::Compressed.

Stdlib::IP::Address::V6::Nosubnet::Full

Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of RFC 2373. It will not match addresses with address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::Nosubnet::Alternate

Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will only match addresses without an address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::Nosubnet::Compressed

Match an IPv6 address which may contain :: used to compress zeros as documented in section 2.2.2 of RFC 2373. It will only match addresses without an address prefix as documented in section 2.3 of RFC 2373.

Stdlib::IP::Address::V6::CIDR

Match an IPv6 address in the CIDR format. It will only match if the address contains an address prefix (for example, it will match 'FF01:0:0:0:0:0:0:101/32', 'FF01::101/60', '::/0', but not 'FF01:0:0:0:0:0:0:101', 'FF01::101', '::').

Stdlib::ObjectStore

Matches cloud object store uris.

Acceptable input example:

s3://mybucket/path/to/file

gs://bucket/file

Valid values: cloud object store uris.

Stdlib::ObjectStore::GSUri

Matches Google Cloud object store uris.

Acceptable input example:

gs://bucket/file

gs://bucket/path/to/file

Valid values: Google Cloud object store uris.

Stdlib::ObjectStore::S3Uri

Matches Amazon Web Services S3 object store uris.

Acceptable input example:

s3://bucket/file

s3://bucket/path/to/file

Valid values: Amazon Web Services S3 object store uris.

Stdlib::Syslogfacility

An enum that defines all syslog facilities defined in RFC5424. This is based on work in the voxpupuli/nrpe module.

Facts

package_provider

Returns the default provider Puppet uses to manage packages on this system.

is_pe

Returns whether Puppet Enterprise is installed. Does not report anything on platforms newer than PE 3.x.

pe_version

Returns the version of Puppet Enterprise installed. Does not report anything on platforms newer than PE 3.x.

pe_major_version

Returns the major version Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.

pe_minor_version

Returns the minor version of Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.

pe_patch_version

Returns the patch version of Puppet Enterprise that is installed.

puppet_vardir

Returns the value of the Puppet vardir setting for the node running Puppet or Puppet agent.

puppet_environmentpath

Returns the value of the Puppet environment path settings for the node running Puppet or Puppet agent.

puppet_server

Returns the Puppet agent's server value, which is the hostname of the Puppet server with which the agent should communicate.

root_home

Determines the root home directory.

Determines the root home directory, which depends on your operating system. Generally this is '/root'.

service_provider

Returns the default provider Puppet uses to manage services on this system

Limitations

As of Puppet Enterprise 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules.

For an extensive list of supported operating systems, see metadata.json

Development

Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our module contribution guide.

To report or research a bug with any part of this module, please go to http://tickets.puppetlabs.com/browse/MODULES.

Contributors

The list of contributors can be found at: https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors.

More Repositories

1

puppet

Server automation framework and application
Ruby
7,082
star
2

showoff

Don't just present; interact with your audience!
JavaScript
932
star
3

r10k

Smarter Puppet deployment
Ruby
800
star
4

facter

Collect and display system facts
Ruby
603
star
5

trapperkeeper

A services framework for Clojure / JVM applications.
Clojure
586
star
6

bolt

Bolt is an open source orchestration tool that automates the manual work it takes to maintain your infrastructure on an as-needed basis or as part of a greater orchestration workflow. It can be installed on your local workstation and connects directly to remote nodes with SSH or WinRM, so you are not required to install any agent software.
Ruby
459
star
7

puppetlabs-mysql

MySQL Puppet Module / Manifests + Types & Providers
Ruby
385
star
8

puppetlabs-apache

Puppet module for the Apache httpd server, maintained by Puppet, Inc.
Ruby
365
star
9

hiera

Lightweight Pluggable Hierarchical Database
Ruby
295
star
10

puppetdb

Centralized Puppet Storage
Clojure
290
star
11

puppetserver

Server automation framework and application
Clojure
280
star
12

puppetlabs-firewall

Puppet Firewall Module
Ruby
269
star
13

puppetlabs-postgresql

Puppet module for managing PostgreSQL
Ruby
228
star
14

puppet-docs

Curated Puppet Documentation
HTML
223
star
15

pdk

The shortest path to better modules: Puppet Development Kit; Download:
Ruby
217
star
16

control-repo

A control repository template
Ruby
197
star
17

pupperware

Container fun time lives here.
Ruby
183
star
18

puppetlabs-concat

File concatenation system for Puppet
Ruby
171
star
19

puppet-vagrant-boxes

Veewee definitions for a set of generic vagrant boxes
Shell
153
star
20

puppetlabs-ntp

Puppet module to manage the NTP service
Ruby
145
star
21

puppetlabs-lvm

Puppet Module to manage LVM
Ruby
126
star
22

puppetlabs_spec_helper

A set of shared spec helpers specific to Puppetlabs projects
Ruby
121
star
23

best-practices

Best practice docs created by the Puppet Customer Success team
CSS
120
star
24

puppetlabs-packer

Packer templates to build images for vSphere
PowerShell
119
star
25

puppetlabs-java

Puppet Module to manage Java
Ruby
103
star
26

puppet-syntax-vim

Puppet language syntax highlighting for Vim
Vim Script
102
star
27

puppet-specifications

Specification of the Puppet Language, Catalog, Extension points
Ruby
97
star
28

vault-plugin-secrets-oauthapp

OAuth 2.0 secrets plugin for HashiCorp Vault supporting a variety of grant types
Go
94
star
29

puppetlabs-kubernetes

This module install and configures a Kubernetes cluster
Ruby
92
star
30

puppet-strings

The next generation Puppet documentation extraction and presentation tool.
Ruby
89
star
31

puppet_litmus

Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.
Ruby
88
star
32

puppetlabs-docker

The Puppet Docker repository
Ruby
87
star
33

cpp-hocon

A C++ port of the Typesafe Config library.
C++
83
star
34

education-builds

Bootstrap CentOS training VMs from scratch. Now with true versioning!
Ruby
82
star
35

puppet-vscode

Puppet Editing. Redefined.
TypeScript
79
star
36

vmpooler

Provide configurable 'pools' of instantly-available (running) virtual machines
Ruby
75
star
37

tasks-hands-on-lab

Deprecated: Please see http://bolt.guide to follow our Bolt tutorial!
Shell
73
star
38

puppetlabs-inifile

Resource types for managing settings in INI files
Ruby
70
star
39

hiera-puppet

Puppet function and data backend for Hiera
Ruby
60
star
40

leatherman

A collection of C++ and CMake utility libraries.
C++
57
star
41

puppet-rfc

Puppet RFC Repository
Ruby
55
star
42

puppetlabs-f5

Puppet Management of F5 Network Devices.
53
star
43

puppetlabs-puppetdb

A puppet module for installing and managing puppetdb
Ruby
52
star
44

relay

Event-driven workflows for DevOps automation
Go
52
star
45

puppetserver-helm-chart

The Helm Chart for Puppet Server
Mustache
51
star
46

puppetlabs-powershell

powershell provider for the Puppet exec resource type
Ruby
50
star
47

puppetlabs-rsync

rsync module
Ruby
49
star
48

puppet-agent

All of the directions for building a puppet agent package.
Ruby
48
star
49

homebrew-puppet

A tap for Puppet macOS package distribution
Ruby
45
star
50

pdk-templates

The main template repo for the Puppet Development Kit https://github.com/puppetlabs/pdk
HTML
43
star
51

docs-archive

An archive of old documentation for Puppet, PE, CD4PE, Pipelines, and their related components. No longer updated, for reference only.
HTML
42
star
52

puppet-editor-services

Puppet Language Server for editors
Ruby
41
star
53

puppetlabs-puppet_agent

Module for managing Puppet-Agent
Ruby
40
star
54

puppetlabs-tomcat

PuppetLabs Tomcat module
Ruby
38
star
55

kream

Kubernetes Rules Everything Around Me. A development environment for the Puppet/kubernetes module
Ruby
38
star
56

packaging

Packaging automation for Puppet software
Ruby
37
star
57

rubocop-i18n

RuboCop rules for detecting and autocorrecting undecorated strings for i18n (gettext and rails-i18n)
Ruby
36
star
58

nssm

Puppet fork of the NSSM source code from https://git.nssm.cc/nssm/nssm.git
C++
36
star
59

puppetlabs-java_ks

Uses a combination of keytool and openssl to manage entries in a Java keystore
Ruby
35
star
60

gatling-puppet-load-test

Scala
34
star
61

ruby-hocon

A Ruby port of the Typesafe Config library.
Ruby
34
star
62

netdev_stdlib

Netdev is a vendor-neutral network abstraction framework maintained by Puppet, Inc
Ruby
30
star
63

puppetlabs-sshkeys

Puppet Labs SSH Public Keys
Shell
30
star
64

puppetlabs-peadm

A Puppet module defining Bolt plans used to automate Puppet Enterprise deployments
Puppet
30
star
65

tasks-playground

Deprecated: Please check out https://bolt.guide to learn about Bolt, or see the project at https://github.com/puppetlabs/bolt
Shell
27
star
66

puppetlabs-node_encrypt

Encrypt secrets inside Puppet catalogs and reports
Ruby
27
star
67

structured-logging

Write data structures to your logs from clojure
Clojure
27
star
68

puppet-resource_api

This library provides a simple way to write new native resources for https://puppet.com.
Ruby
27
star
69

puppetlabs-reboot

Reboot type and provider
Ruby
26
star
70

vanagon

All of your packages will fit into this van with this one simple trick.
Ruby
26
star
71

vmfloaty

A CLI helper tool for Puppet vmpooler to help you stay afloat
Ruby
25
star
72

puppetlabs-registry

Puppet Module for managing the Windows Registry through custom types and providers
Ruby
25
star
73

puppet-syntax-emacs

Puppet language syntax highlighting for Emacs
Emacs Lisp
25
star
74

pxp-agent

PCP eXecution Protocol Agent
C++
22
star
75

puppetlabs-acl

ACL (Access Control List) module
Ruby
20
star
76

clj-i18n

Clojure i18n library and utilities
Clojure
20
star
77

puppetlabs-transition

Transition module
Ruby
20
star
78

puppetlabs-sslcertificate

Puppet module to manage SSL Certificates on WIndows Server 2008 and upwards
Ruby
20
star
79

puppetlabs-accounts

Account management module
Ruby
19
star
80

provision

Simple tasks to provision and tear_down containers / instances and virtual machines.
Ruby
19
star
81

cppbestpractices

Collection of C++ Best Practices at Puppet Labs
C++
19
star
82

clj-kitchensink

Library of utility functions for clojure
Clojure
19
star
83

jvm-ssl-utils

SSL certificate management on the JVM
Clojure
18
star
84

net_http_unix

AF_UNIX domain socket support on top of Ruby's Net::HTTP libraries
Ruby
18
star
85

design-system

A resource for creating user interfaces based on brand, UX, and dev principles
JavaScript
18
star
86

puppet-eucalyptus

Install and management tools for Eucalyptus built with Puppet
Puppet
17
star
87

puppet-classify

A ruby library to interface with the classifier service
Ruby
17
star
88

puppetdb-cli

PuppetDB CLI Tooling
Go
16
star
89

puppetlabs-rcfiles

Customizations for vim, shell, screen, ruby, etc... The goal is to quickly provide an efficient working environment.
Vim Script
16
star
90

puppetlabs-motd

Simple motd module
Ruby
16
star
91

relay-core

Kubernetes-based execution engine
Go
16
star
92

trapperkeeper-webserver-jetty9

Trapperkeeper webservice service (jetty9 implementation).
Clojure
16
star
93

clj-http-client

HTTP client library wrapping Apache HttpAsyncClient
Clojure
15
star
94

bolt-examples

Puppet
15
star
95

puppet-vro-starter_content

Shell
15
star
96

facter-ng

Collect and display system facts
Ruby
15
star
97

ruby-pwsh

A ruby gem for interacting with PowerShell
Ruby
15
star
98

cisco_ios

Cisco IOS Catalyst module
Ruby
14
star
99

learn-to-be-a-puppet-engineer

In this repository we map out skills that our PSE should have, we try link to existing documentation or blog posts, or if they don't exist, create it.
CSS
14
star
100

puppet-gatling-jenkins-plugin

A Jenkins plugin that extends the gatling library
HTML
14
star