From ce6f705881bebee156ad430a017ef9202c6a1f2f Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Mon, 27 Oct 2025 23:05:15 +0100 Subject: [PATCH 1/2] add control for puppetdb.conf - https://gitlab.confdroid.com/internal/confdroid_management/-/issues/284 --- manifests/main/files.pp | 12 ++++++++++++ manifests/params.pp | 13 +++++++++++-- templates/puppetdb/puppetdb.conf.erb | 8 ++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 templates/puppetdb/puppetdb.conf.erb diff --git a/manifests/main/files.pp b/manifests/main/files.pp index b7237ab..b763eaa 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -30,5 +30,17 @@ class puppet_cd::main::files ( content => template($pt_puppet_conf_erb), notify => Service[$pt_agent_service,$pt_server_service], } + + if $pt_use_puppetdb == true { + file { $pt_puppetdb_conf_file: + ensure => file, + path => $pt_puppetdb_conf_file, + owner => 'root', + group => 'root', + mode => '0644', + content => template($pt_puppetdb_conf_erb), + notify => Service[$pt_agent_service,$pt_server_service], + } + } } } diff --git a/manifests/params.pp b/manifests/params.pp index e6620be..ccd79c5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,8 +3,10 @@ # Author: Arne Teuke (arne_teuke@confdroid) # @summary Class manages parameters for the puppet_cd module. # @param [Boolean] pt_manage_fw whether to manage firewall settings +# @param [Boolean] pt_use_puppetdb whether to use puppetdb # @param [String] pt_pm_fqdn the fqdn for the puppetmaster and master -# settings are applied. any other fqdn # will be considered a puppet agent. +# settings are applied. any other fqdn # will be considered a puppet agent. +# @param [String] pt_db_fqdn the fqdn for the puppetdb node. # @param [String] pt_pkg_ensure valid: "present", "latest", "v1.2.3" # @param [String] pt_agent_pkg the packages for agents to install # @param [String] pt_server_pkg the server packages to install @@ -50,11 +52,14 @@ # @param [Array] pt_r10k_webhook_pkg the packages for the r10k webhook # @param [Boolean] pt_manage_user whether to manage the puppet user # @param [String] pt_r10k_webhook_port the port for the webhook listener +# @param [String] pt_ssl_port the port for the puppetdb ssl port ############################################################################### class puppet_cd::params ( Boolean $pt_manage_fw = true, String $pt_pm_fqdn = 'puppetmaster.example.net', + String $pt_db_fqdn = 'puppetdb.example.net', + Boolean $pt_use_puppetdb = false, # installation String $pt_pkg_ensure = 'latest', @@ -101,6 +106,9 @@ class puppet_cd::params ( String $pt_parser = 'current', Boolean $pt_cert_revocation = true, +# puppetdb + String $pt_ssl_port = '8081', + # r10k Boolean $pt_use_r10k = false, Boolean $pt_use_r10k_webhook = false, @@ -137,8 +145,9 @@ class puppet_cd::params ( ## puppet $pt_puppet_conf_file = "${pt_puppetdir}/puppet.conf" $pt_puppet_conf_erb = 'puppet_cd/puppet.conf.erb' - $pt_agent_conf_erb = 'puppet_cd/agent.conf.erb' $pt_hiera_config = "${pt_puppetdir}/hiera.yaml" + $pt_puppetdb_conf_file = "${pt_puppetdir}/puppetdb.conf" + $pt_puppetdb_conf_erb = 'puppet_cd/puppetdb/puppetdb.conf.erb' ## r10k $pt_r10k_file = "${pt_r10k_dir}/r10k.yaml" diff --git a/templates/puppetdb/puppetdb.conf.erb b/templates/puppetdb/puppetdb.conf.erb new file mode 100644 index 0000000..b028ccb --- /dev/null +++ b/templates/puppetdb/puppetdb.conf.erb @@ -0,0 +1,8 @@ + +368 B +############################################################################### +########## puppetdb.conf managed by puppet agent ########## +############################################################################### +[main] +server_urls = https://<%= @pt_db_fqdn%>:<%= @pt_ssl_port %> +soft_write_failure = <%= @pt_soft_write_failure %> \ No newline at end of file From c78f50e5fd52bf79698ee95e0791ac3818f371a0 Mon Sep 17 00:00:00 2001 From: Jenkins Server Date: Mon, 27 Oct 2025 23:06:35 +0100 Subject: [PATCH 2/2] Recommit for updates in build 78 --- .../puppet_cd_3A_3Amain_3A_3Afiles.html | 26 +++++- doc/puppet_classes/puppet_cd_3A_3Aparams.html | 82 +++++++++++++++++-- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html b/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html index 948c615..d2cc4a5 100644 --- a/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html +++ b/doc/puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html @@ -129,7 +129,19 @@ 31 32 33 -34 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46
# File 'manifests/main/files.pp', line 6
@@ -161,6 +173,18 @@ class puppet_cd::main::files (
       content => template($pt_puppet_conf_erb),
       notify  => Service[$pt_agent_service,$pt_server_service],
     }
+
+    if $pt_use_puppetdb == true {
+      file { $pt_puppetdb_conf_file:
+        ensure  => file,
+        path    => $pt_puppetdb_conf_file,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0644',
+        content => template($pt_puppetdb_conf_erb),
+        notify  => Service[$pt_agent_service,$pt_server_service],
+      }
+    }
   }
 }
diff --git a/doc/puppet_classes/puppet_cd_3A_3Aparams.html b/doc/puppet_classes/puppet_cd_3A_3Aparams.html index e4d41b1..aafa834 100644 --- a/doc/puppet_classes/puppet_cd_3A_3Aparams.html +++ b/doc/puppet_classes/puppet_cd_3A_3Aparams.html @@ -101,7 +101,7 @@
-

puppet_cd::params.pp Module name: puppet_cd Author: Arne Teuke (arne_teuke@confdroid) settings are applied. any other fqdn # will be considered a puppet agent.

+

puppet_cd::params.pp Module name: puppet_cd Author: Arne Teuke (arne_teuke@confdroid)

@@ -130,6 +130,24 @@ +
  • + + pt_use_puppetdb + + + (Boolean) + + + (defaults to: false) + + + — +
    +

    whether to use puppetdb

    +
    + +
  • +
  • pt_pm_fqdn @@ -143,7 +161,25 @@ —
    -

    the fqdn for the puppetmaster and master

    +

    the fqdn for the puppetmaster and master settings are applied. any other fqdn # will be considered a puppet agent.

    +
    + +
  • + +
  • + + pt_db_fqdn + + + (String) + + + (defaults to: 'puppetdb.example.net') + + + — +
    +

    the fqdn for the puppetdb node.

  • @@ -918,6 +954,24 @@ —

    the port for the webhook listener

    +
    + + + +
  • + + pt_ssl_port + + + (String) + + + (defaults to: '8081') + + + — +
    +

    the port for the puppetdb ssl port

  • @@ -933,9 +987,6 @@
     
     
    -54
    -55
    -56
     57
     58
     59
    @@ -1037,15 +1088,26 @@
     155
     156
     157
    -158
    +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 -
    # File 'manifests/params.pp', line 54
    +        
    # File 'manifests/params.pp', line 57
     
     class puppet_cd::params (
     
       Boolean $pt_manage_fw             = true,
       String $pt_pm_fqdn                = 'puppetmaster.example.net',
    +  String $pt_db_fqdn                = 'puppetdb.example.net',
    +  Boolean $pt_use_puppetdb          = false,
     
       # installation
       String $pt_pkg_ensure             = 'latest',
    @@ -1092,6 +1154,9 @@ class puppet_cd::params (
       String $pt_parser                 = 'current',
       Boolean $pt_cert_revocation       = true,
     
    +# puppetdb
    +  String $pt_ssl_port               = '8081',
    +
     # r10k
       Boolean $pt_use_r10k              = false,
       Boolean $pt_use_r10k_webhook      = false,
    @@ -1128,8 +1193,9 @@ class puppet_cd::params (
     ## puppet
       $pt_puppet_conf_file              = "${pt_puppetdir}/puppet.conf"
       $pt_puppet_conf_erb               = 'puppet_cd/puppet.conf.erb'
    -  $pt_agent_conf_erb                = 'puppet_cd/agent.conf.erb'
       $pt_hiera_config                  = "${pt_puppetdir}/hiera.yaml"
    +  $pt_puppetdb_conf_file            = "${pt_puppetdir}/puppetdb.conf"
    +  $pt_puppetdb_conf_erb             = 'puppet_cd/puppetdb/puppetdb.conf.erb'
     
     ## r10k
       $pt_r10k_file                     = "${pt_r10k_dir}/r10k.yaml"