Added ability to specify role for corosync nodes.

Partial blueprint: detach-components-from-controllers

Change-Id: I887ad32bd6c9fcaabab5bd56d0825124b5b3e28f
This commit is contained in:
Nikita Koshikov 2015-05-22 15:07:45 -05:00 committed by Alex Schultz
parent 93f2a8e25b
commit 5e76dd1a08
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@ to be used in pcmk_nodes resource.
EOS EOS
) do |args| ) do |args|
nodes = args[0] nodes = args[0]
roles = args[1] || %w(primary-controller controller)
fail "You should provided 'nodes' structure!" unless nodes.is_a? Array and nodes.any? fail "You should provided 'nodes' structure!" unless nodes.is_a? Array and nodes.any?
corosync_nodes = {} corosync_nodes = {}
nodes.each do |node| nodes.each do |node|
@ -12,7 +13,7 @@ to be used in pcmk_nodes resource.
ip = node['internal_address'] ip = node['internal_address']
uid = node['uid'] uid = node['uid']
role = node['role'] role = node['role']
next unless %w(primary-controller controller).include? role next unless roles.include? role
next unless ip and fqdn next unless ip and fqdn
corosync_nodes[fqdn] = { corosync_nodes[fqdn] = {
'id' => uid, 'id' => uid,

View File

@ -1,7 +1,8 @@
notice('MODULAR: cluster.pp') notice('MODULAR: cluster.pp')
$nodes = hiera('nodes') $nodes = hiera('nodes')
$corosync_nodes = corosync_nodes($nodes) $corosync_roles = hiera('corosync_roles',['primary-controller', 'controller'])
$corosync_nodes = corosync_nodes($nodes,$corosync_roles)
$internal_address = hiera('internal_address') $internal_address = hiera('internal_address')
class { 'cluster': class { 'cluster':