Skip to content

Instantly share code, notes, and snippets.

@npwalker
Last active March 15, 2019 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npwalker/167fc911e3d55a4ab9efaf9b742e6423 to your computer and use it in GitHub Desktop.
Save npwalker/167fc911e3d55a4ab9efaf9b742e6423 to your computer and use it in GitHub Desktop.
Implement PuppetDB on Compile Masters (compatible with PE_XL)

Implement PuppetDB on Compile Masters

This procedure will implement a local PE PuppetDB on Compile Masters.

  1. Install and Configure the PE PuppetDB service on Compile Masters

Note: Replace all instances of MASTER.EXAMPLE.COM with the certname of your Primary Master.

Note: Replace all instances of DATABASE.EXAMPLE.COM with the certname of your PE Database host, by default, your Primary Master.

Note: Replace COMPILE.MASTER.REGEX with a regex (ex: .*-compile\..*) that matches your Compile Master certnames.

Note: Verify Data in the Console is enabled: https://puppet.com/docs/pe/2018.1/config_console.html#task-5039

Install and Configure the PE PuppetDB service on Compile Masters

  • Install https://forge.puppet.com/whatsaranjit/node_manager on the Primary Master
  • Run puppet agent -t on the Primary Master

~/classify_pe_puppetdb_on_compile_masters.pp

$puppetdb_database_host = $facts['migrate_database_host']
$compile_master_regex   = 'COMPILE.MASTER.REGEX'

node_group { 'PE Compiler Group A':
  ensure  => 'present',
  parent  => 'PE Master',
  rule    => ['and', ['~', 'name', $compile_master_regex]],
  # In PE_XL, the above regex rule is replaced by the following.
  # rule    => ['and',
  #   ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::compiler'],
  #   ['=', ['trusted', 'extensions', 'pp_cluster'], 'A'],
  # ],
  classes => {
    'puppet_enterprise::profile::puppetdb' => {},
    'puppet_enterprise::profile::master' => {
      'puppetdb_host' => [$clientcert],
      'puppetdb_port' => [8081],
    },
  },
  data    => {
    'puppet_enterprise::profile::puppetdb' => {
      'gc_interval' => '0',
    },
    'puppet_enterprise::puppetdb' => {
      #you can decide if you want these here or in hiera. but we do want to tune these.  
      'command_processing_threads' => 2,
      'write_maximum_pool_size'    => 4,
      'read_maximum_pool_size'     => 10, #this should match the number of jrubies + buffer for pql queries
    },
  },
}

Note, you could instead invert the rule commenting in the above and manually pin your Compile Masters after applying the manifest.

  • Run puppet apply classify_pe_puppetdb_on_compile_masters.pp on the Primary Master
  • Run puppet agent -t --noop on all Compile Masters
  • Run puppet agent -t on the Database Host
  • Run puppet agent -t on the Primary Master
  • Run puppet agent -t on all Compile Masters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment