Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

puppetlabs-stdlib

> 编程语言
Open source

Puppet Labs Standard Library module

350 stars0 likes3 views
WebsiteGitHub

About

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. License
  8. Development
  9. 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:

puppet
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.

yaml
---
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:

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

Unacceptable input example:

bash
../relative_path

Stdlib::Ensure::Service

Matches acceptable ensure values for service resources.

Acceptable input examples:

bash
stopped
running

Unacceptable input example:

bash
true
false

Stdlib::HTTPSUrl

Matches HTTPS URLs. It is a case insensitive match.

Acceptable input example:

bash
https://hello.com

HTTPS://HELLO.COM

Unacceptable input example:

bash
httds://notquiteright.org`

Stdlib::HTTPUrl

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

Acceptable input example:

bash
https://hello.com

http://hello.com

HTTP://HELLO.COM

Unacceptable input example:

bash
httds://notquiteright.org

Stdlib::MAC

Matches MAC addresses defined in RFC5342.

Stdlib::Unixpath

Matches absolute paths on Unix operating systems.

Acceptable input example:

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

/var/tmp

Unacceptable input example:

bash
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:

bash
0644
bash
1777
bash
a=Xr,g=w

Unacceptable input examples:

bash
x=r,a=wx
bash
0999

Stdlib::Windowspath

Matches paths on Windows operating systems.

Acceptable input example:

bash
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:

bash
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:

bash
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:

bash
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:

bash
80

443

65000

Valid values: An Integer.

Stdlib::Port::Privileged

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

Acceptable input examples:

bash
1024

1337

65000

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

Stdlib::Base32

Matches paths a valid base32 string.

Acceptable input example:

bash
ASDASDDASD3453453

asdasddasd3453453=

ASDASDDASD3453453==

Valid values: A base32 string.

Stdlib::Base64

Matches paths a valid base64 string.

Acceptable input example:

bash
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:

bash
s3://mybucket/path/to/file

gs://bucket/file

Valid values: cloud object store uris.

Stdlib::ObjectStore::GSUri

Matches Google Cloud object sto

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubyhacktoberfestmodulesupported

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言