Skip to content

Instantly share code, notes, and snippets.

@michaeltchapman
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaeltchapman/9477263 to your computer and use it in GitHub Desktop.
Save michaeltchapman/9477263 to your computer and use it in GitHub Desktop.
---
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/data/hiera_data
:hierarchy:
- "hostname/%{hostname}"
- "client/%{clientcert}"
- user
- "user.%{scenario}"
- user.common
- "osfamily/%{osfamily}"
- "cinder_backend/%{cinder_backend}"
- "glance_backend/%{glance_backend}"
- "rpc_type/%{rpc_type}"
- "db_type/%{db_type}"
- "tenant_network_type/%{tenant_network_type}"
- "network_type/%{network_type}"
- "network_plugin/%{network_plugin}"
- "password_management/%{password_management}"
- "contrib/networking/%{networking}"
- "contrib/storage/%{storage}"
- "contrib/monitoring/%{monitoring}"
- "scenario/%{scenario}"
- "scenario/%{scenario}/%{role}"
- common
- class_groups
# Globals
$role = regsubst($::hostname, '([a-zA-Z]+)[^a-zA-Z]', '\1')
$scenario = hiera('scenario', "")
$cinder_backend = hiera('cinder_backend', "")
$glance_backend = hiera('glance_backend', "")
$rpc_type = hiera('rpc_type', "")
$db_type = hiera('db_type', "")
$tenant_network_type = hiera('tenant_network_type', "")
$network_type = hiera('network_type', "")
$network_plugin = hiera('network_plugin', "")
$storage = hiera('storage', "")
$networking = hiera('networking', "")
$monitoring = hiera('monitoring', "")
$password_management = hiera('password_management', "")
node default {
notice("my scenario is ${scenario}")
notice("my role is ${role}")
# Should be defined in scenario/[name_of_scenario]/[name_of_role].yaml
$node_class_groups = hiera('class_groups', undef)
notice("class groups: ${node_class_groups}")
if $node_class_groups {
class_group { $node_class_groups: }
}
$node_classes = hiera('classes', undef)
if $node_classes {
include $node_classes
notify { " Including node classes : ${node_classes}": }
}
# get a list of contribs to include.
$stg = hiera("${role}_storage", [])
notice("storage includes ${stg}")
if (size($stg) > 0) {
contrib_group { $stg: }
}
# get a list of contribs to include.
$networking = hiera("${role}_networking", [])
notice("networking includes ${networking}")
if (size($networking) > 0) {
contrib_group { $networking: }
}
# get a list of contribs to include.
$monitoring = hiera('${role}_monitoring', [])
notice("monitoring includes ${monitoring}")
if (size($monitoring) > 0) {
contrib_group { $monitoring: }
}
}
define class_group {
include hiera($name)
notice($name)
$x = hiera($name)
notice( "including ${x}" )
}
define contrib_group {
include hiera("${name}_classes")
notice($name)
$x = hiera("${name}_classes")
notice( "including ${x}" )
}
controller_nodes:
- 10.0.0.1
- 10.0.0.2
galera::servers: %{hiera('controller_nodes')}
@michaeltchapman
Copy link
Author

here, controller_nodes gets flattened into a string, so we're passing the wrong type to the class

@michaeltchapman
Copy link
Author

here, controller_nodes gets flattened into a string, so we're passing the wrong type to the class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment