Puppet Function: puppet_operational_dashboards::hosts_with_profile

Defined in:
functions/hosts_with_profile.pp
Function type:
Puppet Language

Summary

function used to determine hosts with a profile class

Overview

puppet_operational_dashboards::hosts_with_profile(String $profile)Array[String]

Queries PuppetDB for hosts with the specified profile. Used by this module to identify hosts with Puppet Enterprise API endpoints and Telegraf hosts

Parameters:

  • profile (String)

    The full name of the profile to query.

Returns:

  • (Array[String])

    An array of certnames from the query



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'functions/hosts_with_profile.pp', line 11

function puppet_operational_dashboards::hosts_with_profile(
  String $profile,
) >> Array[String] {
  if $settings::storeconfigs {
  puppetdb_query("resources[certname] {
      type = 'Class' and
      title = '${profile}' and
      nodes { deactivated is null and expired is null }
    }").map |$nodes| { $nodes['certname'] }
  } else {
    []
  }
}