### Verify firewall module installation Source: https://help.puppet.com/core/current/Content/PuppetCore/quick_start_firewall.htm Example output showing the successful installation of the firewall module. ```text Preparing to install into /etc/puppetlabs/puppet/environments/production/modules ... Notice: Downloading from https://forgeapi.puppetlabs.com ... Notice: Installing -- do not interrupt ... /etc/puppetlabs/puppet/environments/production/modules └── puppetlabs-firewall (v1.6.0) ``` -------------------------------- ### Example of command line installer syntax Source: https://help.puppet.com/core/current/Content/PuppetCore/resources_package_windows.htm This shows the raw command line syntax for a self-extracting executable installer. ```text ./installer.exe /s /v"MANAGEMENT_SERVER=1.1.1.1 /l*v! c:\temp\log.txt /qn" ``` -------------------------------- ### View module installation output Source: https://help.puppet.com/core/current/Content/PuppetCore/quick_start_ntp.htm Example output confirming the successful installation of the puppetlabs-ntp module. ```text  Preparing to install into /etc/puppetlabs/puppet/modules ...     Notice: Downloading from http://forgeapi.puppetlabs.com ...     Notice: Installing -- do not interrupt ...     /etc/puppetlabs/puppet/environments/production/modules     └── puppetlabs-ntp (v3.1.2) ``` -------------------------------- ### View module installation output Source: https://help.puppet.com/core/current/Content/PuppetCore/quick_start_sudo.htm Example output confirming the successful installation of the saz-sudo module and its dependencies. ```text Preparing to install into /etc/puppetlabs/code/environments/production/modules … Notice: Downloading from http://forgeapi.puppetlabs.com ...     Notice: Installing -- do not interrupt ...     /etc/puppetlabs/puppet/modules     └── saz-sudo (v2.3.6)           └── puppetlabs-stdlib (3.2.2) [/opt/puppet/share/puppet/modules] ``` -------------------------------- ### Manage Windows packages with MSI and EXE Source: https://help.puppet.com/core/current/Content/PuppetCore/resources_package_windows.htm Examples of installing MSI and EXE packages using the windows provider with specific install options. ```puppet package { 'mysql':   ensure          => '5.5.16',   source          => 'N:\packages\mysql-5.5.16-winx64.msi',   install_options => ['INSTALLDIR=C:\mysql-5.5'], } package { "Git version 1.8.4-preview20130916":  ensure          => present,  source          => 'C:\code\puppetlabs\temp\windowsexample\Git-1.8.4-preview20130916.exe',  install_options => ['/VERYSILENT'] } ``` -------------------------------- ### Environments Request and Response Example Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_environments.htm Example of a successful GET request and the resulting JSON response body. ```http GET /puppet/v3/environments HTTP 200 OK Content-Type: application/json {   "search_paths": ["/etc/puppetlabs/code/environments"]   "environments": {     "production": {       "settings": {         "modulepath": ["/etc/puppetlabs/code/environments/production/modules", "/etc/puppetlabs/code/environments/development/modules"],         "manifest": ["/etc/puppetlabs/code/environments/production/manifests"]         "environment_timeout": 180,         "config_version": "/version/of/config"       }     }   } } ``` -------------------------------- ### Install a specific module version Source: https://help.puppet.com/core/current/Content/PuppetCore/modules_command_reference.htm Example command to install a specific version of a module into a testing environment while ignoring dependencies. ```bash puppet module install --environment testing --ignore-dependencies --version 1.0.0-pre1 --strict-semver false puppetlabs-apache ``` -------------------------------- ### Example routes.yaml configuration Source: https://help.puppet.com/core/current/Content/PuppetCore/config_file_routes.htm A basic configuration example showing how to set a terminus and cache for facts. ```yaml --- server: facts: terminus: puppetdb cache: yaml ``` -------------------------------- ### Example puppet:/// URL Source: https://help.puppet.com/core/current/Content/PuppetCore/module_structure.htm Example URL for a file located at my_module/files/service.conf. ```text puppet:///modules/my_module/service.conf ``` -------------------------------- ### Install the agent package Source: https://help.puppet.com/core/current/Content/PuppetCore/install-macos-agents-from-the-command-line-osp.htm Runs the installer package to install the Puppet agent on the system. ```bash sudo installer -pkg puppet-agent-installer.pkg -target / ``` -------------------------------- ### Install gems using the Bundle client Source: https://help.puppet.com/core/current/Content/PuppetCore/install_gems.htm Execute the installation command to fetch gems from the configured source. ```bash bundle install ``` -------------------------------- ### Install gems using the Gem client Source: https://help.puppet.com/core/current/Content/PuppetCore/install_gems.htm Standard command to install a gem after configuring the source. ```bash gem install puppet ``` -------------------------------- ### Start interactive Ruby REPL Source: https://help.puppet.com/core/current/Content/PuppetCore/server/subcommands.htm Launches the JRuby REPL for experimenting with Puppet and installed gems. ```bash $ puppetserver irb irb(main):001:0> require 'puppet' => true irb(main):002:0> puts Puppet[:certname] centos6-64.localdomain => nil ``` ```bash $ lein irb -c /path/to/puppetserver.conf -- --version irb 0.9.6(09/06/30) ``` -------------------------------- ### Define the module installation class Source: https://help.puppet.com/core/current/Content/PuppetCore/bgtm.htm The install class handles software installation resources and is typically kept private. ```puppet class ntp::install {   if $ntp::package_manage {     package { $ntp::package_name:       ensure => $ntp::package_ensure,     }   } } ``` -------------------------------- ### Retrieving a file example Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_file_bucket_file.htm Example request and response for retrieving a file from the bucket. ```http > GET /puppet/v3/file_bucket_file/md5/4949e56d376cc80ce5387e8e89a75396//home/user/myfile.txt?environment=production HTTP/1.1 > Accept: application/octet-stream < HTTP/1.1 200 OK < Content-Length: 24 < This is the file content ``` -------------------------------- ### Install puppetlabs-firewall module Source: https://help.puppet.com/core/current/Content/PuppetCore/quick_start_firewall.htm Command to install the firewall module from the PuppetForge. ```bash puppet module install puppetlabs-firewall ``` -------------------------------- ### Install a module Source: https://help.puppet.com/core/current/Content/PuppetCore/modules_command_reference.htm Installs a module from the Forge using the username-module_name format. ```bash puppet module install puppetlabs-apache ``` -------------------------------- ### Regexp Data Type Examples Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_data_regexp_type.htm Examples showing how to match any regular expression or a specific one. ```puppet Regexp ``` ```puppet Regexp[//] ``` -------------------------------- ### Download and install the release package Source: https://help.puppet.com/core/current/Content/PuppetCore/enable_the_puppet_platform_apt.htm Use these commands to download the repository release package and install it using dpkg. ```bash wget --content-disposition sudo dpkg -i .deb ``` ```bash wget --content-disposition https://apt-puppetcore.puppet.com/public/puppet8-release-focal.deb sudo dpkg -i puppet8-release-focal.deb ``` -------------------------------- ### Start Puppet Server service Source: https://help.puppet.com/core/current/Content/PuppetCore/server/install_from_packages.htm Start the Puppet Server service using systemctl. ```bash sudo systemctl start puppetserver ``` -------------------------------- ### Saving a file example Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_file_bucket_file.htm Example request and response for saving a file to the bucket. ```http > PUT /puppet/v3/file_bucket_file/md5/eb61eead90e3b899c6bcbe27ac581660//home/user/myfile.txt?environment=production HTTP/1.1 > Content-Type: application/octet-stream > Content-Length: 24 > This is the file content < HTTP/1.1 200 OK ``` -------------------------------- ### Example fileserver.conf mount point Source: https://help.puppet.com/core/current/Content/PuppetCore/file_serving.htm A concrete example of mapping a local directory to a Puppet mount point. ```text [installer_files] path /etc/puppetlabs/puppet/installer_files ``` -------------------------------- ### Example Module Directory Structure Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_file_metadata.htm Represents the file system layout used for file metadata examples. ```text /etc/puppetlabs/code/modules/example/   files/     just_a_file.txt     link_to_file.txt -> /etc/puppetlabs/code/modules/example/files/just_a_file.txt     subdirectory/       another_file.txt ``` -------------------------------- ### GET /status/v1/simple request and response Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/status-api/v1/simple.htm Example of a successful GET request to the simple status endpoint returning a plain text status. ```http GET /status/v1/simple HTTP/1.1 200 OK Content-Type: application/json running ``` -------------------------------- ### Execute Puppet scripts via command line Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/script.htm Examples demonstrating how to run a manifest file with logging and how to execute inline Puppet code with a specified module path. ```bash $ puppet script -l /tmp/manifest.log manifest.pp $ puppet script --modulepath=/root/dev/modules -e 'notice("hello world")' ``` -------------------------------- ### Manage SSH with package, file, and service resources Source: https://help.puppet.com/core/current/Content/PuppetCore/the_trifecta.htm Demonstrates the standard pattern of installing a package, configuring its file, and ensuring the associated service is running. Uses notify and require metaparameters to manage resource ordering and service restarts. ```puppet package { 'openssh-server':   ensure => installed, } file { '/etc/ssh/sshd_config':   source  => 'puppet:///modules/sshd/sshd_config',   owner   => 'root',   group   => 'root',   mode    => '0640',   notify  => Service['sshd'], # sshd restarts whenever you edit this file.   require => Package['openssh-server'], } service { 'sshd':   ensure    => running,   enable    => true, } ``` -------------------------------- ### Define Module Impact Source: https://help.puppet.com/core/current/Content/PuppetCore/modules_readme.htm Example of documenting potential side effects or file overwrites in the setup section. ```markdown ## Setup ### What cat affects * Your dog door might be overwritten if not secured before installation. ``` -------------------------------- ### Example resource state hash Source: https://help.puppet.com/core/current/Content/PuppetCore/writing_the_type_and_provider.htm The get method returns an array of hashes representing the current state of resources on the system. ```ruby [   {     name: 'a',     ensure: 'present',   },   {     name: 'b',     ensure: 'present',   }, ] ``` -------------------------------- ### Specify configuration settings on the command line Source: https://help.puppet.com/core/current/Content/PuppetCore/config_about_settings.htm Demonstrates equivalent ways to pass configuration values via command-line arguments. ```text --certname=temporary-name.example.com ``` ```text --certname temporary-name.example.com ``` ```text --certname "temporary-name.example.com" ``` -------------------------------- ### GET /status/v1/services debug request Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/status-api/v1/services.htm Example of a debug-level request to the services endpoint and the corresponding JSON response containing JVM metrics. ```http GET /status/v1/services?level=debug HTTP/1.1 200 OK Content-Type: application/json {   "status-service": {     "detail_level": "debug",       "service_status_version": 1,       "service_version": "0.3.5",       "state": "running",       "status": {         "experimental": {           "jvm-metrics": {             "heap-memory": {               "committed": 1049100288,               "init": 268435456,               "max": 1908932608,               "used": 216512656             },             "non-heap-memory": {               "committed": 256466944,               "init": 2555904,               "max": -1,               "used": 173201432             },             "start-time-ms": 1472496731281,             "up-time-ms": 538974           }         }       }     } } ``` -------------------------------- ### Example puppet.conf file Source: https://help.puppet.com/core/current/Content/PuppetCore/config_set.htm A sample configuration file structure showing main, agent, and server sections. ```ini [main] certname = agent01.example.com server = server.example.com vardir = /var/opt/lib/pe-puppet [agent] report = true graph = true pluginsync = true [server] dns_alt_names = server,server.example.com,puppet,puppet.example.com ``` -------------------------------- ### Example node retrieval request and response Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_node.htm Demonstrates a successful GET request to the node endpoint and the resulting JSON response structure. ```http > GET /puppet/v3/node/mycertname?environment=production&transaction_uuid=aff261a2-1a34-4647-8c20-ff662ec11c4c&configured_environment=production HTTP/1.1 > Accept: application/json, text/pson < HTTP/1.1 200 OK < Content-Type: application/json < Content-Length: 4630 { "name":"thinky.corp.puppetlabs.net", "parameters":{ "architecture":"amd64", "kernel":"Linux", "blockdevices":"sda,sr0", "clientversion":"3.3.1", "clientnoop":"false", "environment":"production", ... }, "environment":"production" } ``` -------------------------------- ### Configure install_options for a package Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/package.htm Demonstrates passing an array of strings and hashes to the install_options attribute for a Windows MSI installation. ```puppet package { 'mysql':   ensure          => installed,   source          => 'N:/packages/mysql-5.5.16-winx64.msi',   install_options => [ '/S', { 'INSTALLDIR' => 'C:\\mysql-5.5' } ], } ``` -------------------------------- ### Install YARD gem Source: https://help.puppet.com/core/current/Content/PuppetCore/puppet_strings_install.htm Install the required YARD dependency before installing Puppet Strings. ```bash gem install yard ``` -------------------------------- ### Example environment.conf configuration Source: https://help.puppet.com/core/current/Content/PuppetCore/config_file_environment.htm Defines the module path and config version script for a specific environment. ```ini # /etc/puppetlabs/code/environments/test/environment.conf # Puppet Enterprise requires $basemodulepath; see note below under "modulepath". modulepath = site:dist:modules:$basemodulepath # Use our custom script to get a git commit for the current state of the code: config_version = get_environment_commit.sh ``` -------------------------------- ### Verify the installation Source: https://help.puppet.com/core/current/Content/PuppetCore/install-macos-agents-from-the-command-line-osp.htm Checks the installed version of the Puppet agent to confirm successful installation. ```bash /opt/puppetlabs/bin/puppet --version ``` -------------------------------- ### Puppet syntax for complex install options Source: https://help.puppet.com/core/current/Content/PuppetCore/resources_package_windows.htm This demonstrates how to split strings with spaces into an array for the install_options attribute. ```puppet install_options => [ '/s', "/v\"MANAGEMENT_SERVER=${management_server}", '/l*v!', "${install_log}", '/qn', '"' ], ``` -------------------------------- ### Install Facter via RubyGems Source: https://help.puppet.com/core/current/Content/PuppetCore/facter.htm Use this command to install the Facter gem if Ruby is already installed on your system. ```bash gem install facter ``` -------------------------------- ### Implement prefix function calls Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_functions_syntax.htm Example demonstrating the use of template, include, and each functions using prefix syntax. ```puppet file {"/etc/ntp.conf":   ensure  => file,   content => template("ntp/ntp.conf.erb"), # function call; resolves to a string } include apache # function call; modifies catalog $binaries = [   "facter",   "hiera",   "mco",   "puppet",   "puppetserver", ] # function call with lambda; runs block of code several times each($binaries) |$binary| {   file {"/usr/bin/$binary":     ensure => link,     target => "/opt/puppetlabs/bin/$binary",   } } ``` -------------------------------- ### List installed gems Source: https://help.puppet.com/core/current/Content/PuppetCore/server/gems.htm Commands to view gems installed in the Puppet Server environment, including a variant for source installations. ```bash $ puppetserver gem list ``` ```bash $ lein gem -c ~/.puppetserver/puppetserver.conf list ``` -------------------------------- ### Common puppet apply command examples Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/apply.htm Demonstrates basic usage including executing inline code, logging to a file, specifying module paths, and applying pre-compiled catalogs. ```bash $ puppet apply -e 'notify { "hello world": }' $ puppet apply -l /tmp/manifest.log manifest.pp $ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server" $ puppet apply --catalog catalog.json ``` -------------------------------- ### Install ruby-debug gem Source: https://help.puppet.com/core/current/Content/PuppetCore/server/dev_debugging.htm Commands to install the ruby-debug gem for either a standard Puppet Server installation or when running from source. ```bash $ sudo puppetserver gem install ruby-debug ``` ```bash $ lein gem -c /path/to/puppetserver.conf install ruby-debug ``` -------------------------------- ### Print Puppet Settings Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/config.htm Examples for retrieving current configuration values. ```bash $ puppet config print rundir ``` ```bash $ puppet config print all --section server | grep -E "(path|dir)" ``` -------------------------------- ### Install Puppet module from tarball Source: https://help.puppet.com/core/current/Content/PuppetCore/modules_installing_from_commandline.htm Use the puppet module install command to install a downloaded tarball directly into a specified module path. ```bash puppet module install ./puppetlabs-cem_linux-1.6.1.tar.gz --ignore-dependencies --modulepath ``` -------------------------------- ### Example Hiera 4 configuration file Source: https://help.puppet.com/core/current/Content/PuppetCore/convert_experimental_hiera_yaml.htm A sample configuration file using the experimental Hiera 4 format. ```yaml # /etc/puppetlabs/code/environments/production/hiera.yaml --- version: 4 datadir: data hierarchy:   - name: "Nodes"     backend: yaml     path: "nodes/%{trusted.certname}"   - name: "Exported JSON nodes"     backend: json     paths:       - "nodes/%{trusted.certname}"       - "insecure_nodes/%{facts.networking.fqdn}"   - name: "virtual/%{facts.virtual}"     backend: yaml   - name: "common"     backend: yaml ``` -------------------------------- ### Install hiera-eyaml Source: https://help.puppet.com/core/current/Content/PuppetCore/securing-sensitive-data.htm Install the hiera-eyaml gem using the puppetserver command. ```bash puppetserver gem install hiera-eyaml ``` -------------------------------- ### Complete Hiera 5 Configuration Example Source: https://help.puppet.com/core/current/Content/PuppetCore/convert_hiera_yaml.htm A full example of a version 5 hiera.yaml file incorporating legacy backends, eyaml, and standard YAML hierarchy levels. ```yaml version: 5 defaults:   datadir: data   data_hash: yaml_data hierarchy:   - name: "Per-node data (yaml version)"     path: "nodes/%{trusted.certname}.yaml" # Add file extension     # Omitting datadir and data_hash to use defaults.   - name: "Per-node data (MongoDB version)"     path: "nodes/%{trusted.certname}"      # No file extension     hiera3_backend: mongodb     options:    # Use old backend-specific options, changing keys to plain strings       connections:         dbname: hdata         collection: config         host: localhost   - name: "Per-group secrets"     path: "groups/%{facts.group}.eyaml"     lookup_key: eyaml_lookup_key     options:       pkcs7_private_key: /etc/puppetlabs/puppet/eyaml/private_key.pkcs7.pem       pkcs7_public_key:  /etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pem   - name: "Other YAML hierarchy levels"     paths: # Can specify an array of paths instead of a single one.       - "location/%{facts.whereami}/%{facts.group}.yaml"       - "groups/%{facts.group}.yaml"       - "os/%{facts.os.family}.yaml"       - "common.yaml" ``` -------------------------------- ### Verify Puppet Server installation Source: https://help.puppet.com/core/current/Content/PuppetCore/server/install_from_packages.htm Check the installed version of Puppet Server. ```bash puppetserver -v ``` -------------------------------- ### Common puppet describe usage examples Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/describe.htm These commands demonstrate how to list available types, describe specific resource providers, and display concise information about resources. ```bash $ puppet describe --list $ puppet describe file --providers $ puppet describe user -s -m ``` -------------------------------- ### Retrieve Node Information Examples Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/node.htm Examples demonstrating how to use the puppet node find command with different termini and rendering options. ```bash $ puppet node find somenode.puppetlabs.lan --terminus plain --render-as yaml ``` ```bash $ puppet node find somenode.puppetlabs.lan --terminus exec --run_mode server --render-as yaml ``` ```bash $ puppet node find somenode.puppetlabs.lan --terminus rest --render-as yaml ``` -------------------------------- ### Install a module from the Forge Source: https://help.puppet.com/core/current/Content/PuppetCore/modules_installing_from_commandline.htm Installs a module and its dependencies into the default modulepath directory. ```bash puppet module install puppetlabs-apache ``` -------------------------------- ### puppet module install Source: https://help.puppet.com/core/current/Content/PuppetCore/Markdown/module.htm Installs a module from the Puppet Forge or a release archive. ```APIDOC ## puppet module install ### Description Installs a module from the Puppet Forge or from a release archive file. Note: Module install uses MD5 checksums, which are prohibited on FIPS enabled systems. ### Parameters #### Path Parameters - **name** (string) - Required - The name of the module to install. #### Options - **--force | -f** (flag) - Optional - Force overwrite of existing module. - **--ignore-dependencies** (flag) - Optional - Do not attempt to install dependencies. - **--target-dir DIR | -i DIR** (string) - Optional - The directory into which modules are installed. - **--version VER | -v VER** (string) - Optional - Module version to install. ``` -------------------------------- ### Start Puppet agent service Source: https://help.puppet.com/core/current/Content/PuppetCore/clear_regenerate_certs_for_agents.htm Starts the Puppet agent service on the node. ```bash sudo puppet resource service puppet ensure=running ``` ```powershell puppet resource service puppet ensure=running ``` -------------------------------- ### Define Ordering Relationships Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_relationships.htm Examples demonstrating equivalent ordering using 'before' in the prior resource or 'require' in the subsequent resource. ```puppet package { 'openssh-server':   ensure => present,   before => File['/etc/ssh/sshd_config'], } ``` ```puppet file { '/etc/ssh/sshd_config':   ensure  => file,   mode    => '0600',   source  => 'puppet:///modules/sshd/sshd_config',   require => Package['openssh-server'], } ``` -------------------------------- ### Certificate response examples Source: https://help.puppet.com/core/current/Content/PuppetCore/server/http_api/http_certificate.htm Examples of successful and error responses from the certificate endpoint. ```http GET /puppet-ca/v1/certificate/elmo.mydomain.com HTTP 200 OK Content-Type: text/plain -----BEGIN CERTIFICATE----- MIIFujCCA6KgAwIBAgIBATANBgkqhkiG9w0BAQsFADBiMWAwXgYDVQQDDFdQdXBw ZXQgQ0EgZ2VuZXJhdGVkIG9uIGRoY3A1MC5reWxvLmJhY2tsaW5lLnB1cHBldGxh YnMubmV0IGF0IDIwMTMtMDYtMjQgMTY6MzA6MTcgLTA3MDAwHhcNMTMwNjIzMjMz MDE5WhcNMTgwNjIzMjMzMDE5WjBiMWAwXgYDVQQDDFdQdXBwZXQgQ0EgZ2VuZXJh dGVkIG9uIGRoY3A1MC5reWxvLmJhY2tsaW5lLnB1cHBldGxhYnMubmV0IGF0IDIw MTMtMDYtMjQgMTY6MzA6MTcgLTA3MDAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw ggIKAoICAQDABq1lmzccjuRmnCdXvTmdeXJGb9S8r8+I+G6fkHTa1WKDSob9PZpS eXJtanbl0zNws9yBt1Dko2zhKDKctBRWf5CT42nDxBZPY7SaD7KaCzb07g9wfWgU BOb/6smyl/iySEmQzzFLRgZbo5A9WLiy/UdyQim1faakevRme2Xi/l/i0TKbpu27 DhCS+E8aC8Bvaj0ph0T+TzYphTR76pP5Kps6G7Jyk/HFYrVXnY44X2PEt2mgkEXp xHCbU+qCFMtTLMG+ZArA/noM3I/O6W5LhLSzApjut/M7UdMlpZ45PGDrsvf2R306 NcOh+zbbkhxuIaGqaxeaenYzbOlA3gXhZvYaV6EKjXNtm7BslpsvhLi0U+CWyb3C qRkpex0MgxJgxoqViJ4TDVA+EmztOnK86+G4HGeJqTPQloYO/Td1wMT1Txh9T5Ue Wctw/g+4o22EyJQRo+vxxzHNRIfe7EHAerMUtLT5u9MJeQb9N1iUR2ATNAN+QiB2 KEqyc9eMapK6QUZFV23Xvbdup1WCrgsWXBqyRWKV7x0sc9Wv8RMRKEFYaBeHEVXU m0hGgF34Z8Rzphq2H1FjkLD+xbtGOjrA1Mb2De81Hfvrf18497X5UMPtsuzOt/XU PHbbSCy+05J7VNZ/gaiGqgpHfcG5yiqCdj1LIzhFuuvm+fADPxK38wIDAQABo3sw eTA3BglghkgBhvhCAQ0EKhYoUHVwcGV0IFJ1YnkvT3BlblNTTCBJbnRlcm5hbCBD ZXJ0aWZpY2F0ZTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV HQ4EFgQUEhn/MqSDtuxg12klWosCGenxf1cwDQYJKoZIhvcNAQELBQADggIBAH1G L3FG/keKlGqs70PxxvR1wCo4VM3K/C+5uxnzm1MHEAd96nhtwE6YSkUe+XgDiXfC +NXS2C4TeTQAEo6grREapWDjhJvrhrgqTZmb4lTKzb91II3/VGYzG5UXxID262zy QLoX/IBN/xDJ5ds0wF2adUbnHUssEGGljgngewH/7kjeW/L5iL+USXZnKHPSggjM RAEjlucE/rDqDNoxhOS4K2PjseFm7krW4cZ0gNmxdrhc7OhmJ56dH92F4M9jn7Qy EqxWB304U/aMcO3NJxTQc7AreL/pUtjtI6hxM4miHbjSh6RfNBqhzRyJvxA6gc6g m3kumdw04KZFSs/6fPFFbI60i5K+vioB4CnUWpj+3Z+OnDEvhQJEACR1JC8A67Ih x+GDlbHLU1BWonwZzSMJz+ABXV3dwIrOSFHI0UmDXg+cIdZ+SaL93qMjUVU4v9nu gR9yJGMqNuzLjgfbD/KGCEEAITKBwPvCVd//OMlWVrXr7vvt+yo6STIlTJxABJDp CSLyHUtT++CsPXsPADxgRctpIbh1eMFEivkK9Oy+W/CZYIZnARVysUpMWg7TkXqx mSCXy9ZXLWqU/ssVhbLS9vFVa5pvxcyfiRpsFg0XZsx8mnZP6OaWcL8FjF+/NwNP tg1+DuYTn+d54OHi/GZEnvutgrDZyrJDrrb/Czm9 -----END CERTIFICATE----- ``` ```http GET /puppet-ca/v1/certificate/certificate_does_not_exist HTTP 404 Not Found Content-Type: text/plain Not Found: Could not find certificate certificate_does_not_exist ``` ```http GET /puppet-ca/v1/certificate HTTP/1.1 400 Bad Request Content-Type: text/plain No request key specified in /puppet-ca/v1/certificate ``` ```http GET /puppet-ca/v1/certificate/valid_certificate HTTP/1.1 400 Bad Request Content-Type: text/plain this server is not a CA ``` -------------------------------- ### Example Hiera 3 configuration file Source: https://help.puppet.com/core/current/Content/PuppetCore/convert_hiera_yaml.htm A sample version 3 hiera.yaml file using Ruby symbols as keys and legacy backend configurations. ```yaml :backends:   - mongodb   - eyaml   - yaml :yaml:   :datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata" :mongodb:   :connections:     :dbname: hdata     :collection: config     :host: localhost :eyaml:   :datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"   :pkcs7_private_key: /etc/puppetlabs/puppet/eyaml/private_key.pkcs7.pem   :pkcs7_public_key:  /etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pem :hierarchy:   - "nodes/%{trusted.certname}"   - "location/%{facts.whereami}/%{facts.group}"   - "groups/%{facts.group}"   - "os/%{facts.os.family}"   - "common" :logger: console :merge_behavior: native :deep_merge_options: {} ``` -------------------------------- ### Instantiate SemVer objects Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_data_abstract_flexible.htm Examples of creating SemVer instances using different input formats. ```puppet SemVer.new("1.2.3") ``` ```puppet SemVer.new(1, 2, 3, "rc4", "5") ``` ```puppet SemVer.new(major => 1, minor => 2, patch => 3, prerelease => "rc4", build =>"5") ``` -------------------------------- ### Compare Hiera 3 and Hiera 5 Configuration Source: https://help.puppet.com/core/current/Content/PuppetCore/legacy_hiera_3_backends.htm Example showing the translation of a legacy v3 hiera.yaml configuration into the equivalent v5 format using the hiera3_backend key. ```yaml # hiera.yaml v3 --- :backends:   - mongodb   - xml :mongodb:   :connections:     :dbname: hdata     :collection: config     :host: localhost :xml:   :datadir: /some/other/dir :hierarchy:   - "%{trusted.certname}"   - "common" # hiera.yaml v5 --- version: 5 hierarchy:   - name: MongoDB     hiera3_backend: mongodb     paths:       - "%{trusted.certname}"       - common     options:       connections:         dbname: hdata         collection: config         host: localhost   - name: Data in XML     hiera3_backend: xml     datadir: /some/other/dir     paths:       - "%{trusted.certname}.xml"       - common.xml ``` -------------------------------- ### Enum Usage Examples Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_data_abstract_flexible.htm Examples of Enum matching specific string values. ```puppet Enum['stopped', 'running'] ``` ```puppet Enum['true', 'false'] ``` -------------------------------- ### Install F5 device module Source: https://help.puppet.com/core/current/Content/PuppetCore/installing_device_modules.htm Installs the f5-f5 module on the primary Puppet server. ```bash $ sudo puppet module install f5-f5 ``` -------------------------------- ### Apply puppet configuration Source: https://help.puppet.com/core/current/Content/PuppetCore/lang_scope_override.htm Shows the output of the variable override example when applied. ```bash $ puppet apply site.pp notice: Message from here: Hi, I'm local! ``` -------------------------------- ### Example facter.conf configuration Source: https://help.puppet.com/core/current/Content/PuppetCore/configuring_facter.htm A sample configuration file demonstrating the structure of facts, global, cli, and fact-groups sections. ```hocon facts : {     blocklist : [ "file system", "EC2", "os.architecture" ],     ttls : [         { "timezone" : 30 days },     ] } global : {     external-dir     : [ "path1", "path2" ],     custom-dir       : [ "custom/path" ],     no-exernal-facts : false,     no-custom-facts  : false,     no-ruby          : false } cli : {     debug     : false,     trace     : true,     verbose   : false,     log-level : "warn" } fact-groups : {  custom-group-name : ["os.name", "ssh"], } ``` -------------------------------- ### Start Puppet Server service Source: https://help.puppet.com/core/current/Content/PuppetCore/clear_regenerate_certs_on_primary_server.htm Starts the Puppet Server service after certificate regeneration. ```bash sudo puppet resource service puppetserver ensure=running ``` -------------------------------- ### Incorrect parameter formatting examples Source: https://help.puppet.com/core/current/Content/PuppetCore/style_guide_classes.htm Examples of invalid indentation and alignment patterns to avoid. ```puppet class profile::myclass (       $var1    = 'default',       $var2    = 'something else',       $another = 'another default value', ) { } ``` ```puppet class profile::myclass ( $var1    = 'default', $var2    = 'something else', $another = 'another default value', ) { } ``` ```puppet class profile::myclass (   $var1 = 'default',   $var2  = 'something else',   $another = 'another default value', ) { } ```