From c5a77d54cebb6c303885e4bb5be8bd18377a066e Mon Sep 17 00:00:00 2001 From: Aaron McCracken Date: Mon, 16 Oct 2023 19:06:25 +0100 Subject: [PATCH] Exclusion Work for indicator_exclusions using hiera --- README.md | 13 +++++++++++++ hiera.yaml | 1 + plans/agent_summary.pp | 3 ++- plans/infra_summary.pp | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdf58cc..42d824b 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,21 @@ plan_hierarchy: data_hash: yaml_data ``` + See the following [documentation](https://puppet.com/docs/bolt/latest/hiera.html#outside-apply-blocks) for further explanation. +#### Using Static Hiera data to populate indicator_exclusions when executing plans + +Place the plan_hierarchy listed in the step above, in the environment layer (https://www.puppet.com/docs/pe/latest/writing_plans_in_puppet_language_pe.html#using_hiera_with_plans) + +Create a [static.yaml] file in the environment layer hiera data directory``` +```yaml +pe_status_check::indicator_exclusions: + - '' +``` + +Indicator ID's within array will be excluded when `running pe_status_check::infra_summary` and `pe_status_check::agent_summary` p + #### Running the plans The `pe_status_check::infra_summary` and `pe_status_check::agent_summary` plans can be run from the [PE console](https://puppet.com/docs/pe/latest/running_plans_from_the_console_.html) or from [the command line](https://puppet.com/docs/pe/latest/running_plans_from_the_command_line.html). Below are some examples of running the plans from the command line. More information on the parameters in the plan can be seen in the [REFERENCE.md](REFERENCE.md). diff --git a/hiera.yaml b/hiera.yaml index dc66227..2bd47ed 100644 --- a/hiera.yaml +++ b/hiera.yaml @@ -23,3 +23,4 @@ hierarchy: plan_hierarchy: - name: "Static data" path: "static.yaml" + data_hash: yaml_data \ No newline at end of file diff --git a/plans/agent_summary.pp b/plans/agent_summary.pp index 381f9d5..28fcb4f 100644 --- a/plans/agent_summary.pp +++ b/plans/agent_summary.pp @@ -6,8 +6,9 @@ # Defaults to using a PuppetDB query to identify nodes # @param indicator_exclusions # List of disabled indicators, place any indicator ids you do not wish to report on in this list +# Static Hiera Data can be used to set indicator_exclusions in a plan - for more information see https://www.puppet.com/docs/pe/latest/writing_plans_in_puppet_language_pe.html#using_hiera_with_plans plan pe_status_check::agent_summary( - Array[String[1]] $indicator_exclusions = [], + Array[String[1]] $indicator_exclusions = lookup('pe_status_check::indicator_exclusions', undef, undef, []), Optional[TargetSpec] $targets = undef, ) { # Query PuppetDB if $targets is not unspecified diff --git a/plans/infra_summary.pp b/plans/infra_summary.pp index cda36ec..49777c3 100644 --- a/plans/infra_summary.pp +++ b/plans/infra_summary.pp @@ -6,8 +6,9 @@ # Defaults to using a PuppetDB query to identify nodes # @param indicator_exclusions # List of disabled indicators, place any indicator ids you do not wish to report on in this list +# Static Hiera Data can be used to set indicator_exclusions in a plan - for more information see https://www.puppet.com/docs/pe/latest/writing_plans_in_puppet_language_pe.html#using_hiera_with_plans plan pe_status_check::infra_summary( - Array[String[1]] $indicator_exclusions = [], + Array[String[1]] $indicator_exclusions = lookup('pe_status_check::indicator_exclusions', undef, undef, []), Optional[TargetSpec] $targets = undef, ) { # Query PuppetDB if $targets is not unspecified