Forge Home

simplib

A collection of common SIMP functions, facts, and types

147,194 downloads

3,508 latest version

4.7 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 4.12.2 (latest)
  • 4.12.1
  • 4.12.0
  • 4.11.0
  • 4.10.4
  • 4.10.3
  • 4.10.2
  • 4.10.1
  • 4.10.0
  • 4.9.0
  • 4.8.0
  • 4.7.1
  • 4.7.0
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.5.0
  • 4.4.1
  • 4.4.0
  • 4.3.0
  • 4.2.1
  • 4.2.0
  • 4.1.0
  • 4.0.1
  • 4.0.0
  • 3.15.3
  • 3.15.2
  • 3.15.1
  • 3.15.0
  • 3.14.1
  • 3.14.0
  • 3.13.0
  • 3.12.0
  • 3.11.1
  • 3.11.0
  • 3.10.1
  • 3.10.0
  • 3.9.1
  • 3.9.0
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.0
  • 3.3.1
  • 1.3.2
  • 1.3.1 (deleted)
  • 1.0.1 (deleted)
  • 1.0.0 (deleted)
released Feb 12th 2024
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
  • Puppet >= 7.0.0 < 9.0.0
  • AlmaLinux, Amazon, Archlinux, CentOS, Darwin, Debian, Fedora, FreeBSD, Gentoo, LinuxMint, OpenBSD, OpenSUSE, OracleLinux, RedHat, Pop!_OS, Rocky, SLES, Scientific, Solaris, Ubuntu, VirtuozzoLinux, Windows

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'simp-simplib', '4.12.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add simp-simplib
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install simp-simplib --version 4.12.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

simp/simplib — version 4.12.2 Feb 12th 2024

License CII Best Practices Puppet Forge Puppet Forge Downloads Build Status

Table of Contents

This is a SIMP module

This module is a component of the System Integrity Management Platform, a compliance-management framework built on Puppet.

If you find any issues, they can be submitted to our JIRA.

Module Description

simp-simplib provides a standard library of resources commonly used by SIMP modules but generally suited for any Puppet environment.

Setup

What simplib affects

simplib contains data types, custom types and providers, facts, functions, and a class that expands puppetlabs-stdlib stages.

Setup Requirements

Agents will need to enable pluginsync.

Usage

Please see reference for usage.

Reference

Items not covered by puppet strings are provided below.

See REFERENCE.md for all other reference documentation.

Facts

  • acpid_enabled - Return true if ACPI is available on the system
  • boot_dir_uuid - Return the UUID of the partition holding the boot directory
  • cmdline - Returns the contents of /proc/cmdline as a hash
  • cpuinfo - Returns the contents of /proc/cpuinfo as a hash
  • defaultgateway - Return the default gateway of the system
  • defaultgatewayiface - Return the default gw interface of the system
  • fips_ciphers - Returns a list of available OpenSSL ciphers
  • fips_enabled - Determine whether FIPS is enabled on this system
  • fullrun - Determine whether to do an intensive run
  • gdm_version - Return the version of GDM that is installed
  • grub_version - Return the grub version installed on the system
  • init_systems - Return a list of all init systems present on the system
  • ipa - Return a hash containing the IPA domain and server to which a host is connected
  • ipv6_enabled - Return true if IPv6 is enabled and false if not
  • login_defs - Return the contents of /etc/login.defs as a hash with downcased keys
  • prelink - Returns a hash containing prelink status
  • reboot_required - Returns a hash of 'name' => 'reason' entries
  • root_dir_uuid - Return the UUID of the partition holding the / directory
  • runlevel - Return the current system runlevel
  • shmall - Return the value of shmall from sysctl
  • simplib__efi_enabled - Returns true if the system is using EFI
  • simplib__secure_boot_enabled - Returns true if the host is using uEFI Secure Boot
  • simplib__firewalls - Return an array of known firewall commands that are present on the system.
  • simplib__mountpoints - Return a hash of mountpoints of particular interest to SIMP modules.
  • simplib__numa - Return hash of numa values about your system.
  • simplib_sysctl - Return hash of sysctl values that are relevant to SIMP
  • simp_puppet_settings - Returns a hash of all Puppet settings on a node
  • tmp_mounts - DEPRECATED - use simplib__mountpoints This fact provides information about /tmp, /var/tmp, and /dev/shm should they be present on the system
  • uid_min - Return the minimum uid allowed

Run stages

See REFERENCE.md#simplibstages

Puppet extensions

The following methods are Puppet extensions in the PuppetX::SIMP::Simplib namespace:

PuppetX::SIMP::Simplib::hostname?

Determine whether the passed value is a valid hostname, optionally postpended with ':\<number>' or '/\<number>'.

NOTE: This returns true for an IPv4 address, as it conforms to RFC 1123.

Arguments:

  • obj Input to be assessed

Returns: Boolean false if obj is not comprised of ASCII letters (upper or lower case), digits, hyphens (except at the beginning and end), and dots (except at beginning and end), excluding an optional, trailing ':\<number>' or '/\<number>'

Examples:

  # Returns true
  PuppetX::SIMP::Simplib.hostname?('hostname.me.com')
  PuppetX::SIMP::Simplib.hostname?('hostname.me.com:5454')

  # Returns false
  PuppetX::SIMP::Simplib.hostname?('-hostname.me.com')

PuppetX::SIMP::Simplib::hostname_only?

Determine whether the passed value is a valid hostname.

NOTE: This returns true for an IPv4 address, as it conforms to RFC 1123.

Arguments:

  • obj Input to be assessed

Returns: Boolean false if obj is not comprised of ASCII letters (upper or lower case), digits, hyphens (except at the beginning and end), and dots (except at beginning and end)

Examples:

  # Returns true
  PuppetX::SIMP::Simplib.hostname_only?('hostname.me.com')

  # Returns false
  PuppetX::SIMP::Simplib.hostname_only?('-hostname.me.com')
  PuppetX::SIMP::Simplib.hostname_only?('hostname.me.com:5454')

PuppetX::SIMP::Simplib::human_sort

Sort a list of values based on usual human sorting semantics.

Arguments:

  • obj Enumerable object to be sorted

Returns: Sorted object

PuppetX::SIMP::Simplib::split_port

Split input string into a [ host, port ] pair

Arguments:

  • host_string String to be split into host and port

Returns: Array[ host, port ] Host and port pair

* Returns ``[ nil, nil ]`` if ``host_string`` is ``nil`` or
  an empty string
* Returns ``[ host_string, nil ]`` if ``host_string`` is
  a CIDR address or contains no port
* Port returned is a string

Examples:

  PuppetX::SIMP::Simplib.split_port('myhost.name:5656')
  # returns ['myhost.name','5656']

  PuppetX::SIMP::Simplib.split_port['192.165.3.9']
  # returns ['192.165.3.9',nil]

  PuppetX::SIMP::Simplib.split_port['192.165.3.9/24']
  # returns ['192.164.3.9/24',nil]

  PuppetX::SIMP::Simplib.split_port('[2001:0db8:85a3:0000:0000:8a2e:0370]:'))
  # returns ['[2001:0db8:85a3:0000:0000:8a2e:0370]',nil]

Development

Please read our Contribution Guide.

If you find any issues, they can be submitted to our JIRA.