{"id":15022524,"url":"https://github.com/puppetlabs/puppetlabs-stdlib","last_synced_at":"2025-05-13T00:20:10.702Z","repository":{"id":38865956,"uuid":"1794823","full_name":"puppetlabs/puppetlabs-stdlib","owner":"puppetlabs","description":"Puppet Labs Standard Library module","archived":false,"fork":false,"pushed_at":"2025-04-23T11:59:46.000Z","size":4489,"stargazers_count":349,"open_issues_count":25,"forks_count":582,"subscribers_count":194,"default_branch":"main","last_synced_at":"2025-04-23T12:49:36.807Z","etag":null,"topics":["hacktoberfest","module","supported"],"latest_commit_sha":null,"homepage":"http://forge.puppetlabs.com/puppetlabs/stdlib","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-05-24T18:07:16.000Z","updated_at":"2025-04-23T11:59:50.000Z","dependencies_parsed_at":"2022-07-12T17:39:49.463Z","dependency_job_id":"5f70094c-2832-4227-9839-872c2b144680","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib","commit_stats":{"total_commits":1787,"total_committers":304,"mean_commits":5.878289473684211,"dds":0.919418019026301,"last_synced_commit":"99aebdd57d665ac7e2ba38ab95f3fbdbc2fb56e0"},"previous_names":[],"tags_count":97,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-stdlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-stdlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-stdlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fpuppetlabs-stdlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/puppetlabs-stdlib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250492731,"owners_count":21439583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","module","supported"],"created_at":"2024-09-24T19:58:04.301Z","updated_at":"2025-04-23T18:41:05.828Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stdlib\n\n#### Table of Contents\n\n1. [Overview](#overview)\n1. [Module Description](#module-description)\n1. [Setup](#setup)\n1. [Usage](#usage)\n1. [Reference](#reference)\n    1. [Data Types](#data-types)\n    1. [Facts](#facts)\n1. [Limitations](#limitations)\n1. [License](#license)\n1. [Development](#development)\n1. [Contributors](#contributors)\n\n## Overview\n\nThis module provides a standard library of resources for Puppet modules.\n\n## Module Description\n\nPuppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:\n\n * Stages\n * Facts\n * Functions\n * Defined types\n * Data types\n * Providers\n\n\u003e *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.\n\n## Setup\n\n[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.\n\nIf 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.\n\n## Usage\n\nMost 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`.\n\nWhen declared, stdlib declares all other classes in the module. This currently consists of `stdlib::manage` and `stdlib::stages`.\n\nThe `stdlib::stages` class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):\n\n  * setup\n  * main\n  * runtime\n  * setup_infra\n  * deploy_infra\n  * setup_app\n  * deploy_app\n  * deploy\n\nSample usage:\n\n```puppet\nnode default {\n  include stdlib\n  class { java: stage =\u003e 'runtime' }\n}\n```\n\nThe `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.\n\n```yaml\n---\nstdlib::manage::create_resources:\n  file:\n    /etc/somefile:\n      ensure: file\n      owner: root\n      group: root\n  package:\n    badpackage:\n      ensure: absent\n```\n\n## Reference\n\nFor information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/REFERENCE.md).\n\n\u003ca id=\"data-types\"\u003e\u003c/a\u003e\n### Data types\n\n#### `Stdlib::Absolutepath`\n\nA strict absolute path type. Uses a variant of Unixpath and Windowspath types.\n\nAcceptable input examples:\n\n```shell\n/var/log\n```\n\n```shell\n/usr2/username/bin:/usr/local/bin:/usr/bin:.\n```\n\n```shell\nC:\\\\WINDOWS\\\\System32\n```\n\nUnacceptable input example:\n\n```shell\n../relative_path\n```\n\n#### `Stdlib::Ensure::Service`\n\nMatches acceptable ensure values for service resources.\n\nAcceptable input examples:\n\n```shell\nstopped\nrunning\n```\n\nUnacceptable input example:\n\n```shell\ntrue\nfalse\n```\n\n#### `Stdlib::HTTPSUrl`\n\nMatches HTTPS URLs. It is a case insensitive match.\n\nAcceptable input example:\n\n```shell\nhttps://hello.com\n\nHTTPS://HELLO.COM\n```\n\nUnacceptable input example:\n\n```shell\nhttds://notquiteright.org`\n```\n\n#### `Stdlib::HTTPUrl`\n\nMatches both HTTPS and HTTP URLs. It is a case insensitive match.\n\nAcceptable input example:\n\n```shell\nhttps://hello.com\n\nhttp://hello.com\n\nHTTP://HELLO.COM\n```\n\nUnacceptable input example:\n\n```shell\nhttds://notquiteright.org\n```\n\n#### `Stdlib::MAC`\n\nMatches MAC addresses defined in [RFC5342](https://tools.ietf.org/html/rfc5342).\n\n#### `Stdlib::Unixpath`\n\nMatches absolute paths on Unix operating systems.\n\nAcceptable input example:\n\n```shell\n/usr2/username/bin:/usr/local/bin:/usr/bin:\n\n/var/tmp\n```\n\nUnacceptable input example:\n\n```shell\nC:/whatever\n\nsome/path\n\n../some/other/path\n```\n\n#### `Stdlib::Filemode`\n\nMatches octal file modes consisting of one to four numbers and symbolic file modes.\n\nAcceptable input examples:\n\n```shell\n0644\n```\n\n```shell\n1777\n```\n\n```shell\na=Xr,g=w\n```\n\nUnacceptable input examples:\n\n```shell\nx=r,a=wx\n```\n\n```shell\n0999\n```\n\n#### `Stdlib::Windowspath`\n\nMatches paths on Windows operating systems.\n\nAcceptable input example:\n\n```shell\nC:\\\\WINDOWS\\\\System32\n\nC:\\\\\n\n\\\\\\\\host\\\\windows\n```\n\nValid values: A windows filepath.\n\n#### `Stdlib::Filesource`\n\nMatches paths valid values for the source parameter of the Puppet file type.\n\nAcceptable input example:\n\n```shell\nhttp://example.com\n\nhttps://example.com\n\nfile:///hello/bla\n```\n\nValid values: A filepath.\n\n#### `Stdlib::Fqdn`\n\nMatches paths on fully qualified domain name.\n\nAcceptable input example:\n\n```shell\nlocalhost\n\nexample.com\n\nwww.example.com\n```\nValid values: Domain name of a server.\n\n#### `Stdlib::Host`\n\nMatches a valid host which could be a valid ipv4, ipv6 or fqdn.\n\nAcceptable input example:\n\n```shell\nlocalhost\n\nwww.example.com\n\n192.0.2.1\n```\n\nValid values: An IP address or domain name.\n\n#### `Stdlib::Port`\n\nMatches a valid TCP/UDP Port number.\n\nAcceptable input examples:\n\n```shell\n80\n\n443\n\n65000\n```\n\nValid values: An Integer.\n\n#### `Stdlib::Port::Privileged`\n\nMatches a valid TCP/UDP Privileged port i.e. \u003c 1024.\n\nAcceptable input examples:\n\n```shell\n80\n\n443\n\n1023\n```\n\nValid values: A number less than 1024.\n\n#### `Stdlib::Port::Unprivileged`\n\nMatches a valid TCP/UDP Privileged port i.e. \u003e= 1024.\n\nAcceptable input examples:\n\n```shell\n1024\n\n1337\n\n65000\n\n```\n\nValid values: A number more than or equal to 1024.\n\n#### `Stdlib::Base32`\n\nMatches paths a valid base32 string.\n\nAcceptable input example:\n\n```shell\nASDASDDASD3453453\n\nasdasddasd3453453=\n\nASDASDDASD3453453==\n```\n\nValid values: A base32 string.\n\n#### `Stdlib::Base64`\n\nMatches paths a valid base64 string.\n\nAcceptable input example:\n\n```shell\nasdasdASDSADA342386832/746+=\n\nasdasdASDSADA34238683274/6+\n\nasdasdASDSADA3423868327/46+==\n```\n\nValid values: A base64 string.\n\n#### `Stdlib::Ipv4`\n\nThis type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4).\n\n#### `Stdlib::Ipv6`\n\nThis type is no longer available. To make use of this functionality, use  [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6).\n\n#### `Stdlib::Ip_address`\n\nThis type is no longer available. To make use of this functionality, use  [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress)\n\n#### `Stdlib::IP::Address`\n\nMatches 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.\n\nExamples:\n\n```\n'127.0.0.1' =~ Stdlib::IP::Address                                # true\n'10.1.240.4/24' =~ Stdlib::IP::Address                            # true\n'52.10.10.141' =~ Stdlib::IP::Address                             # true\n'192.168.1' =~ Stdlib::IP::Address                                # false\n'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address  # true\n'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address                     # true\n```\n\n#### `Stdlib::IP::Address::V4`\n\nMatch 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.\n\nExamples:\n\n```\n'127.0.0.1' =~ Stdlib::IP::Address::V4                                # true\n'10.1.240.4/24' =~ Stdlib::IP::Address::V4                            # true\n'192.168.1' =~ Stdlib::IP::Address::V4                                # false\n'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4  # false\n'12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4                   # false\n```\n\nValid values: An IPv4 address.\n\n#### `Stdlib::IP::Address::V6`\n\nMatch any string consisting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.\n\nExamples:\n\n```\n'127.0.0.1' =~ Stdlib::IP::Address::V6                                # false\n'10.1.240.4/24' =~ Stdlib::IP::Address::V6                            # false\n'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6  # true\n'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6                     # true\n'FF01::101' =~ Stdlib::IP::Address::V6                                # true\n```\n\nValid values: An IPv6 address.\n\n#### `Stdlib::IP::Address::Nosubnet`\n\nMatch 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').\n\nValid values: An IP address with no subnet.\n\n#### `Stdlib::IP::Address::V4::CIDR`\n\nMatch 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'\nbut not '192.168.0.6').\n\nValid 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'.\n\n#### `Stdlib::IP::Address::V4::Nosubnet`\n\nMatch 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').\n\nValid values: An IPv4 address with no subnet.\n\n#### `Stdlib::IP::Address::V6::Full`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::Alternate`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::Compressed`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::Nosubnet`\n\nAlias to allow `Stdlib::IP::Address::V6::Nosubnet::Full`, `Stdlib::IP::Address::V6::Nosubnet::Alternate` and `Stdlib::IP::Address::V6::Nosubnet::Compressed`.\n\n#### `Stdlib::IP::Address::V6::Nosubnet::Full`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::Nosubnet::Alternate`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::Nosubnet::Compressed`\n\nMatch 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).\n\n#### `Stdlib::IP::Address::V6::CIDR`\n\nMatch 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',\nbut not 'FF01:0:0:0:0:0:0:101', 'FF01::101', '::').\n\n#### `Stdlib::ObjectStore`\n\nMatches cloud object store uris.\n\nAcceptable input example:\n\n```shell\ns3://mybucket/path/to/file\n\ngs://bucket/file\n\n```\nValid values: cloud object store uris.\n\n\n#### `Stdlib::ObjectStore::GSUri`\n\nMatches Google Cloud object store uris.\n\nAcceptable input example:\n\n```shell\n\ngs://bucket/file\n\ngs://bucket/path/to/file\n\n```\nValid values: Google Cloud object store uris.\n\n\n#### `Stdlib::ObjectStore::S3Uri`\n\nMatches Amazon Web Services S3 object store uris.\n\nAcceptable input example:\n\n```shell\ns3://bucket/file\n\ns3://bucket/path/to/file\n\n```\nValid values: Amazon Web Services S3 object store uris.\n\n#### `Stdlib::Syslogfacility`\n\nAn 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.\n\n\u003ca id=\"facts\"\u003e\u003c/a\u003e\n### Facts\n\n#### `package_provider`\n\nReturns the default provider Puppet uses to manage packages on this system.\n\n#### `is_pe`\n\nReturns whether Puppet Enterprise is installed. Does not report anything on platforms newer than PE 3.x.\n\n#### `pe_version`\n\nReturns the version of Puppet Enterprise installed. Does not report anything on platforms newer than PE 3.x.\n\n#### `pe_major_version`\n\nReturns the major version Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.\n\n#### `pe_minor_version`\n\nReturns the minor version of Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.\n\n#### `pe_patch_version`\n\nReturns the patch version of Puppet Enterprise that is installed.\n\n#### `puppet_vardir`\n\nReturns the value of the Puppet vardir setting for the node running Puppet or Puppet agent.\n\n#### `puppet_environmentpath`\n\nReturns the value of the Puppet environment path settings for the node running Puppet or Puppet agent.\n\n#### `puppet_server`\n\nReturns the Puppet agent's `server` value, which is the hostname of the Puppet server with which the agent should communicate.\n\n#### `root_home`\n\nDetermines the root home directory.\n\nDetermines the root home directory, which depends on your operating system. Generally this is '/root'.\n\n#### `service_provider`\n\nReturns the default provider Puppet uses to manage services on this system\n\n## Limitations\n\nAs 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.\n\nFor an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/metadata.json)\n\n## License\n\nThis codebase is licensed under the Apache2.0 licensing, however due to the nature of the codebase the open source dependencies may also use a combination of [AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html), [BSD-2](https://opensource.org/license/bsd-2-claus), [BSD-3](https://opensource.org/license/bsd-3-claus), [GPL2.0](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html), [LGPL](https://opensource.org/license/lgpl-3-0/), [MIT](https://opensource.org/license/mit/) and [MPL](https://opensource.org/license/mpl-2-0/) Licensing.\n\n## Development\n\nPuppet 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/main/CONTRIBUTING.md).\n\nTo report or research a bug with any part of this module, please go to [https://github.com/puppetlabs/puppetlabs-stdlib/issues](https://github.com/puppetlabs/puppetlabs-stdlib/issues).\n\n## Contributors\n\nThe list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors](https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-stdlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-stdlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fpuppetlabs-stdlib/lists"}