Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set more data types and document classes & defines #663

Merged
merged 3 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Puppet agent
# @api private
class puppet::agent {
contain puppet::agent::install
contain puppet::agent::config
Expand Down
1 change: 1 addition & 0 deletions manifests/agent/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Puppet agent configuration
# @api private
class puppet::agent::config inherits puppet::config {
puppet::config::agent{
'classfile': value => $::puppet::classfile;
Expand Down
3 changes: 2 additions & 1 deletion manifests/agent/install.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Install the puppet client installation
# Install the puppet agent package
# @api private
class puppet::agent::install(
$manage_packages = $::puppet::manage_packages,
$package_name = $::puppet::client_package,
Expand Down
3 changes: 2 additions & 1 deletion manifests/agent/service.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Set up the puppet client as a service
# Set up the puppet agent as a service
# @api private
class puppet::agent::service {

case $::puppet::runmode {
Expand Down
2 changes: 2 additions & 0 deletions manifests/agent/service/cron.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Set up running the agent via cron
# @api private
class puppet::agent::service::cron (
Boolean $enabled = false,
) {
Expand Down
2 changes: 2 additions & 0 deletions manifests/agent/service/daemon.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Set up running the agent as a daemon
# @api private
class puppet::agent::service::daemon (
Boolean $enabled = false,
) {
Expand Down
2 changes: 2 additions & 0 deletions manifests/agent/service/systemd.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Set up running the agent via a systemd timer
# @api private
class puppet::agent::service::systemd (
Boolean $enabled = false,
) {
Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Set up the puppet config
# @api private
class puppet::config(
$allow_any_crl_auth = $::puppet::allow_any_crl_auth,
$auth_allowed = $::puppet::auth_allowed,
Expand Down
14 changes: 11 additions & 3 deletions manifests/config/agent.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Set a config entry in the [agent] section
#
# @param value
# The value for the config entry
# @param key
# The key of the config entry
# @param joiner
# How to join an array value into a string
define puppet::config::agent (
$value,
$key = $name,
$joiner = ','
Variant[Array[String], Boolean, String, Integer] $value,
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"agent_${name}":
key => $key,
Expand Down
23 changes: 18 additions & 5 deletions manifests/config/entry.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Set a config entry
#
# @param key
# The key of the config entry
# @param value
# The value for the config entry
# @param section
# The section for the config entry
# @param sectionorder
# How to order the section. This is only used on the first definition of the
# section via ensure_resource.
# @param joiner
# How to join an array value into a string
define puppet::config::entry (
$key,
$value,
$section,
$sectionorder = 5,
$joiner = ',',
String $key,
Variant[Array[String], Boolean, String, Integer] $value,
String $section,
Variant[Integer[0], String] $sectionorder = 5,
String $joiner = ',',
) {
if ($value =~ Array) {
$_value = join(flatten($value), $joiner)
Expand Down
14 changes: 11 additions & 3 deletions manifests/config/main.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Set a config entry in the [main] section
#
# @param value
# The value for the config entry
# @param key
# The key of the config entry
# @param joiner
# How to join an array value into a string
define puppet::config::main (
$value,
$key = $name,
$joiner = ','
Variant[Array[String], Boolean, String, Integer] $value,
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"main${name}":
key => $key,
Expand Down
14 changes: 11 additions & 3 deletions manifests/config/master.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Set a config entry in the [master] section
#
# @param value
# The value for the config entry
# @param key
# The key of the config entry
# @param joiner
# How to join an array value into a string
define puppet::config::master (
$value,
$key = $name,
$joiner = ','
Variant[Array[String], Boolean, String, Integer] $value,
String $key = $name,
String $joiner = ','
) {
puppet::config::entry{"master_${name}":
key => $key,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Default parameters
# @api private
class puppet::params {

# Basic config
Expand Down
60 changes: 52 additions & 8 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
#
# === Advanced server parameters:
#
# $codedir:: Override the puppet code directory.
#
# $config_version:: How to determine the configuration version. When
# using git_repo, by default a git describe
# approach will be installed.
Expand All @@ -137,13 +139,12 @@
#
# $puppet_basedir:: Where is the puppet code base located
#
# $enc_api:: What version of enc script to deploy. Valid
# values are 'v2' for latest, and 'v1'
# for Foreman =< 1.2
# $enc_api:: What version of enc script to deploy.
#
# $report_api:: What version of report processor to deploy.
# Valid values are 'v2' for latest, and 'v1'
# for Foreman =< 1.2
#
# $compile_mode:: Used to control JRuby's "CompileMode", which may improve performance.
#
#
# $request_timeout:: Timeout in node.rb script for fetching
# catalog from Foreman (in seconds).
Expand Down Expand Up @@ -194,6 +195,10 @@
#
# $puppetserver_vardir:: The path of the puppetserver var dir
#
# $puppetserver_rundir:: The path of the puppetserver run dir
#
# $puppetserver_logdir:: The path of the puppetserver log dir
#
# $puppetserver_dir:: The path of the puppetserver config dir
#
# $puppetserver_version:: The version of puppetserver 2 installed (or being installed)
Expand All @@ -206,6 +211,14 @@
#
# $max_requests_per_instance:: Max number of requests per jruby instance. Defaults to 0 (disabled)
#
# $max_queued_requests:: The maximum number of requests that may be queued waiting to borrow a
# JRuby from the pool. (Puppetserver 5.x only)
# Defaults to 0 (disabled) for Puppetserver >= 5.0
#
# $max_retry_delay:: Sets the upper limit for the random sleep set as a Retry-After header on
# 503 responses returned when max-queued-requests is enabled. (Puppetserver 5.x only)
# Defaults to 1800 for Puppetserver >= 5.0
#
# $idle_timeout:: How long the server will wait for a response on an existing connection
#
# $connect_timeout:: How long the server will wait for a response to a connection attempt
Expand All @@ -230,7 +243,7 @@
# can query the certificate-status endpoint
# Defaults to [ '127.0.0.1', '::1', $::ipaddress ]

# $server_custom_trusted_oid_mapping:: A hash of custom trusted oid mappings. Defaults to undef
# $custom_trusted_oid_mapping:: A hash of custom trusted oid mappings.
# Example: { 1.3.6.1.4.1.34380.1.2.1.1 => { shortname => 'myshortname' } }
#
# $admin_api_whitelist:: The whitelist of clients that
Expand All @@ -243,6 +256,12 @@
# $use_legacy_auth_conf:: Should the puppetserver use the legacy puppet auth.conf?
# Defaults to false (the puppetserver will use its own conf.d/auth.conf)
#
# $check_for_updates:: Should the puppetserver phone home to check for available updates?
#
# $environment_class_cache_enabled:: Enable environment class cache in conjunction with the use of the
# environment_classes API.
#
#
# $allow_header_cert_info:: Allow client authentication over HTTP Headers
# Defaults to false, is also activated by the $http setting
#
Expand Down Expand Up @@ -283,6 +302,31 @@
# $ca_enable_infra_crl:: Enable the separate CRL for Puppet infrastructure nodes
# Defaults to false
#
# $acceptor_threads:: This sets the number of threads that the webserver will dedicate to accepting
# socket connections for unencrypted HTTP traffic. If not provided, the webserver
# defaults to the number of virtual cores on the host divided by 8, with a minimum
# of 1 and maximum of 4.
#
# $selector_threads:: This sets the number of selectors that the webserver will dedicate to processing
# events on connected sockets for unencrypted HTTPS traffic. If not provided,
# the webserver defaults to the minimum of: virtual cores on the host divided by 2
# or max-threads divided by 16, with a minimum of 1.
#
# $max_threads:: This sets the maximum number of threads assigned to responding to HTTP and/or
# HTTPS requests for a single webserver, effectively changing how many
# concurrent requests can be made at one time. If not provided, the
# webserver defaults to 200.
#
# $ssl_acceptor_threads:: This sets the number of threads that the webserver will dedicate to accepting
# socket connections for encrypted HTTPS traffic. If not provided, defaults to
# the number of virtual cores on the host divided by 8, with a minimum of 1 and maximum of 4.
#
# $ssl_selector_threads:: This sets the number of selectors that the webserver will dedicate to processing
# events on connected sockets for encrypted HTTPS traffic. Defaults to the number of
# virtual cores on the host divided by 2, with a minimum of 1 and maximum of 4.
# The number of selector threads actually used by Jetty is twice the number of selectors
# requested. For example, if a value of 3 is specified for the ssl-selector-threads setting,
# Jetty will actually use 6 selector threads.
class puppet::server(
Variant[Boolean, Stdlib::Absolutepath] $autosign = $::puppet::autosign,
Array[String] $autosign_entries = $::puppet::autosign_entries,
Expand Down Expand Up @@ -346,8 +390,8 @@
Optional[Variant[String, Array[String]]] $package = $::puppet::server_package,
Optional[String] $version = $::puppet::server_version,
String $certname = $::puppet::server_certname,
Enum['v2', 'v1'] $enc_api = $::puppet::server_enc_api,
Enum['v2', 'v1'] $report_api = $::puppet::server_report_api,
Enum['v2'] $enc_api = $::puppet::server_enc_api,
Enum['v2'] $report_api = $::puppet::server_report_api,
Integer[0] $request_timeout = $::puppet::server_request_timeout,
Boolean $strict_variables = $::puppet::server_strict_variables,
Hash[String, Data] $additional_settings = $::puppet::server_additional_settings,
Expand Down
1 change: 1 addition & 0 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Set up the puppet server config
# @api private
class puppet::server::config inherits puppet::config {
contain 'puppet::server::puppetserver'
unless empty($::puppet::server::puppetserver_vardir) {
Expand Down
2 changes: 2 additions & 0 deletions manifests/server/enc.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Set up the ENC config
# @api private
class puppet::server::enc(
$enc_path = $::puppet::server::external_nodes
) {
Expand Down
1 change: 1 addition & 0 deletions manifests/server/install.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Install the puppet server
# @api private
class puppet::server::install {

# Mirror the relationship, as defined() is parse-order dependent
Expand Down
80 changes: 38 additions & 42 deletions manifests/server/puppetserver.pp
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
# == Class: puppet::server::puppetserver
#
# Configures the puppetserver jvm configuration file using augeas.
#
# === Parameters:
#
# * `java_bin`
# Path to the java executable to use
# @api private
#
# * `config`
# Path to the jvm configuration file.
# This file is usually either /etc/default/puppetserver or
# /etc/sysconfig/puppetserver depending on your *nix flavor.
# @param java_bin
# Path to the java executable to use
#
# * `jvm_min_heap_size`
# Translates into the -Xms option and is added to the JAVA_ARGS
# @param config
# Path to the jvm configuration file.
# This file is usually either /etc/default/puppetserver or
# /etc/sysconfig/puppetserver depending on your *nix flavor.
#
# * `jvm_max_heap_size`
# Translates into the -Xmx option and is added to the JAVA_ARGS
# @param jvm_min_heap_size
# Translates into the -Xms option and is added to the JAVA_ARGS
#
# * `jvm_extra_args`
# Custom options to pass through to the java binary. These get added to
# the end of the JAVA_ARGS variable
# @param jvm_max_heap_size
# Translates into the -Xmx option and is added to the JAVA_ARGS
#
# * `jvm_cli_args`
# Custom options to pass through to the java binary when using a
# puppetserver subcommand, (eg puppetserver gem). These get used
# in the JAVA_ARGS_CLI variable.
# @param jvm_extra_args
# Custom options to pass through to the java binary. These get added to
# the end of the JAVA_ARGS variable
#
# * `server_puppetserver_dir`
# Puppetserver config directory
# @param jvm_cli_args
# Custom options to pass through to the java binary when using a
# puppetserver subcommand, (eg puppetserver gem). These get used
# in the JAVA_ARGS_CLI variable.
#
# * `server_puppetserver_vardir`
# Puppetserver var directory
# @param server_puppetserver_dir
# Puppetserver config directory
#
# * `server_jruby_gem_home`
# Puppetserver jruby gemhome
# @param server_puppetserver_vardir
# Puppetserver var directory
#
# * `server_cipher_suites`
# Puppetserver array of acceptable ciphers
# @param server_jruby_gem_home
# Puppetserver jruby gemhome
#
# * `server_ssl_protocols`
# Puppetserver array of acceptable ssl protocols
# @param server_cipher_suites
# Puppetserver array of acceptable ciphers
#
# * `server_max_active_instances`
# Puppetserver number of max jruby instances
# @param server_ssl_protocols
# Puppetserver array of acceptable ssl protocols
#
# * `server_max_requests_per_instance`
# Puppetserver number of max requests per jruby instance
# @param server_max_active_instances
# Puppetserver number of max jruby instances
#
# * `server_max_queued_requests`
# The maximum number of requests that may be queued waiting
# to borrow a JRuby from the pool.
# @param server_max_requests_per_instance
# Puppetserver number of max requests per jruby instance
#
# * `server_max_retry_delay`
# Sets the upper limit for the random sleep set as a Retry-After
# header on 503 responses returned when max-queued-requests is enabled.
# @param server_max_queued_requests
# The maximum number of requests that may be queued waiting
# to borrow a JRuby from the pool.
#
# === Example
# @param server_max_retry_delay
# Sets the upper limit for the random sleep set as a Retry-After
# header on 503 responses returned when max-queued-requests is enabled.
#
# @example
#
Expand Down
1 change: 1 addition & 0 deletions manifests/server/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# @param $enable Whether to enable the service or not
# @param $service_name The service name to manage
#
# @api private
class puppet::server::service(
Boolean $enable = true,
String $service_name = 'puppetserver',
Expand Down