Skip to content

Commit

Permalink
Merge pull request #205 from Aaronoftheages/SUP_3709_Indicator_Exclus…
Browse files Browse the repository at this point in the history
…ions_from_Hiera_pe_status_check

(SUP-3709) - Indicator Exclusion using code manager and Hiera lookup
  • Loading branch information
MartyEwings authored Oct 18, 2023
2 parents 4f94f46 + c5a77d5 commit d787913
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- '<TEST ID>'
```

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).
Expand Down
1 change: 1 addition & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ hierarchy:
plan_hierarchy:
- name: "Static data"
path: "static.yaml"
data_hash: yaml_data
3 changes: 2 additions & 1 deletion plans/agent_summary.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion plans/infra_summary.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d787913

Please sign in to comment.