-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #30078 - add parameter to accept a hostgroup config hash
- Loading branch information
Anand Patel
authored and
Anand Patel
committed
Jun 25, 2020
1 parent
7462292
commit b114dba
Showing
3 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
# Installs foreman_default_hostgroup plugin | ||
class foreman::plugin::default_hostgroup { | ||
foreman::plugin {'default_hostgroup': } | ||
# @summary This class installs the default_hostgroup plugin and optionally manages the configuration file | ||
# | ||
# @param hostgroups An hash of hostgroup names and facts to add to the configuration | ||
# | ||
class foreman::plugin::default_hostgroup ( | ||
Hash[String, Hash[String, Variant[String, Integer]]] $hostgroups = {}, | ||
){ | ||
if $hostgroups { | ||
$config = template('foreman/default_hostgroup.yaml.erb') | ||
} else { | ||
$config = undef | ||
} | ||
|
||
foreman::plugin {'default_hostgroup': | ||
config => $config, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
:default_hostgroup: | ||
:facts_map: | ||
<%= @hostgroups.sort.each do |group, fact_kv| -%> | ||
'<%= group %>': | ||
<% fact_kv.each do |key, value| -%> | ||
'<%= key %>': '<%= value %>' | ||
<% end -%> | ||
<% end -%> |