5 1. [Overview](#overview)
6 1. [Module Description](#module-description)
9 1. [Reference](#reference)
10 1. [Data Types](#data-types)
12 1. [Limitations](#limitations)
13 1. [Development](#development)
14 1. [Contributors](#contributors)
18 This module provides a standard library of resources for Puppet modules.
22 Puppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:
31 > *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.
35 [Install](https://puppet.com/docs/puppet/latest/modules_installing.html) the stdlib module to add the functions, facts, and resources of this standard library to Puppet.
37 If you are authoring a module that depends on stdlib, be sure to [specify dependencies](https://puppet.com/docs/puppet/latest/modules_installing.html) in your metadata.json.
41 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`.
43 When declared, stdlib declares all other classes in the module. The only other class currently included in the module is `stdlib::stages`.
45 The `stdlib::stages` class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):
61 class { java: stage => 'runtime' }
67 For information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/REFERENCE.md).
69 <a id="data-types"></a>
72 #### `Stdlib::Absolutepath`
74 A strict absolute path type. Uses a variant of Unixpath and Windowspath types.
76 Acceptable input examples:
83 /usr2/username/bin:/usr/local/bin:/usr/bin:.
90 Unacceptable input example:
96 #### `Stdlib::Ensure::Service`
98 Matches acceptable ensure values for service resources.
100 Acceptable input examples:
107 Unacceptable input example:
114 #### `Stdlib::HTTPSUrl`
116 Matches HTTPS URLs. It is a case insensitive match.
118 Acceptable input example:
126 Unacceptable input example:
129 httds://notquiteright.org`
132 #### `Stdlib::HTTPUrl`
134 Matches both HTTPS and HTTP URLs. It is a case insensitive match.
136 Acceptable input example:
146 Unacceptable input example:
149 httds://notquiteright.org
154 Matches MAC addresses defined in [RFC5342](https://tools.ietf.org/html/rfc5342).
156 #### `Stdlib::Unixpath`
158 Matches absolute paths on Unix operating systems.
160 Acceptable input example:
163 /usr2/username/bin:/usr/local/bin:/usr/bin:
168 Unacceptable input example:
178 #### `Stdlib::Filemode`
180 Matches octal file modes consisting of one to four numbers and symbolic file modes.
182 Acceptable input examples:
196 Unacceptable input examples:
206 #### `Stdlib::Windowspath`
208 Matches paths on Windows operating systems.
210 Acceptable input example:
213 C:\\WINDOWS\\System32
220 Valid values: A windows filepath.
222 #### `Stdlib::Filesource`
224 Matches paths valid values for the source parameter of the Puppet file type.
226 Acceptable input example:
236 Valid values: A filepath.
240 Matches paths on fully qualified domain name.
242 Acceptable input example:
251 Valid values: Domain name of a server.
255 Matches a valid host which could be a valid ipv4, ipv6 or fqdn.
257 Acceptable input example:
267 Valid values: An IP address or domain name.
271 Matches a valid TCP/UDP Port number.
273 Acceptable input examples:
283 Valid values: An Integer.
285 #### `Stdlib::Port::Privileged`
287 Matches a valid TCP/UDP Privileged port i.e. < 1024.
289 Acceptable input examples:
299 Valid values: A number less than 1024.
301 #### `Stdlib::Port::Unprivileged`
303 Matches a valid TCP/UDP Privileged port i.e. >= 1024.
305 Acceptable input examples:
316 Valid values: A number more than or equal to 1024.
318 #### `Stdlib::Base32`
320 Matches paths a valid base32 string.
322 Acceptable input example:
332 Valid values: A base32 string.
334 #### `Stdlib::Base64`
336 Matches paths a valid base64 string.
338 Acceptable input example:
341 asdasdASDSADA342386832/746+=
343 asdasdASDSADA34238683274/6+
345 asdasdASDSADA3423868327/46+==
348 Valid values: A base64 string.
352 This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4).
356 This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6).
358 #### `Stdlib::Ip_address`
360 This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress)
362 #### `Stdlib::IP::Address`
364 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.
369 '127.0.0.1' =~ Stdlib::IP::Address # true
370 '10.1.240.4/24' =~ Stdlib::IP::Address # true
371 '52.10.10.141' =~ Stdlib::IP::Address # true
372 '192.168.1' =~ Stdlib::IP::Address # false
373 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address # true
374 'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address # true
377 #### `Stdlib::IP::Address::V4`
379 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.
384 '127.0.0.1' =~ Stdlib::IP::Address::V4 # true
385 '10.1.240.4/24' =~ Stdlib::IP::Address::V4 # true
386 '192.168.1' =~ Stdlib::IP::Address::V4 # false
387 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4 # false
388 '12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4 # false
391 Valid values: An IPv4 address.
393 #### `Stdlib::IP::Address::V6`
395 Match any string consistenting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.
400 '127.0.0.1' =~ Stdlib::IP::Address::V6 # false
401 '10.1.240.4/24' =~ Stdlib::IP::Address::V6 # false
402 'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6 # true
403 'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6 # true
404 'FF01::101' =~ Stdlib::IP::Address::V6 # true
407 Valid values: An IPv6 address.
409 #### `Stdlib::IP::Address::Nosubnet`
411 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').
413 Valid values: An IP address with no subnet.
415 #### `Stdlib::IP::Address::V4::CIDR`
417 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'
418 but not '192.168.0.6').
420 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'.
422 #### `Stdlib::IP::Address::V4::Nosubnet`
424 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').
426 Valid values: An IPv4 address with no subnet.
428 #### `Stdlib::IP::Address::V6::Full`
430 Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt), with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
432 #### `Stdlib::IP::Address::V6::Alternate`
434 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](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
436 #### `Stdlib::IP::Address::V6::Compressed`
438 Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
440 #### `Stdlib::IP::Address::V6::Nosubnet`
442 Alias to allow `Stdlib::IP::Address::V6::Nosubnet::Full`, `Stdlib::IP::Address::V6::Nosubnet::Alternate` and `Stdlib::IP::Address::V6::Nosubnet::Compressed`.
444 #### `Stdlib::IP::Address::V6::Nosubnet::Full`
446 Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will not match addresses with address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
448 #### `Stdlib::IP::Address::V6::Nosubnet::Alternate`
450 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](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
452 #### `Stdlib::IP::Address::V6::Nosubnet::Compressed`
454 Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
456 #### `Stdlib::IP::Address::V6::CIDR`
458 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',
459 but not 'FF01:0:0:0:0:0:0:101', 'FF01::101', '::').
461 #### `Stdlib::ObjectStore`
463 Matches cloud object store uris.
465 Acceptable input example:
468 s3://mybucket/path/to/file
473 Valid values: cloud object store uris.
476 #### `Stdlib::ObjectStore::GSUri`
478 Matches Google Cloud object store uris.
480 Acceptable input example:
486 gs://bucket/path/to/file
489 Valid values: Google Cloud object store uris.
492 #### `Stdlib::ObjectStore::S3Uri`
494 Matches Amazon Web Services S3 object store uris.
496 Acceptable input example:
501 s3://bucket/path/to/file
504 Valid values: Amazon Web Services S3 object store uris.
506 #### `Stdlib::Syslogfacility`
508 An enum that defines all syslog facilities defined in [RFC5424](https://tools.ietf.org/html/rfc5424). This is based on work in the [voxpupuli/nrpe](https://github.com/voxpupuli/puppet-nrpe/commit/5700fd4f5bfc3e237195c8833039f9ed1045cd6b) module.
513 #### `package_provider`
515 Returns the default provider Puppet uses to manage packages on this system.
519 Returns whether Puppet Enterprise is installed. Does not report anything on platforms newer than PE 3.x.
523 Returns the version of Puppet Enterprise installed. Does not report anything on platforms newer than PE 3.x.
525 #### `pe_major_version`
527 Returns the major version Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
529 #### `pe_minor_version`
531 Returns the minor version of Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
533 #### `pe_patch_version`
535 Returns the patch version of Puppet Enterprise that is installed.
539 Returns the value of the Puppet vardir setting for the node running Puppet or Puppet agent.
541 #### `puppet_environmentpath`
543 Returns the value of the Puppet environment path settings for the node running Puppet or Puppet agent.
547 Returns the Puppet agent's `server` value, which is the hostname of the Puppet master with which the agent should communicate.
551 Determines the root home directory.
553 Determines the root home directory, which depends on your operating system. Generally this is '/root'.
555 #### `service_provider`
557 Returns the default provider Puppet uses to manage services on this system
561 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.
563 For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/metadata.json)
567 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](https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/CONTRIBUTING.md).
569 To report or research a bug with any part of this module, please go to
570 [http://tickets.puppetlabs.com/browse/MODULES](http://tickets.puppetlabs.com/browse/MODULES).
574 The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors](https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors).