Skip to content

Commit

Permalink
Allow multiple rings in nodelist
Browse files Browse the repository at this point in the history
Closes #262
  • Loading branch information
rhamon authored and roidelapluie committed Aug 31, 2016
1 parent 6939858 commit 2eef8be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
# [*quorum_members*]
# Array of quorum member hostname. This is required if set_votequorum
# is set to true.
# You can also have an array of arrays to have multiple rings. In that case,
# each subarray matches a member IP addresses.
# Defaults to ['localhost']
#
# [*quorum_members_ids*]
Expand Down
6 changes: 4 additions & 2 deletions templates/corosync.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ quorum {

<% unless @votequorum_expected_votes -%>
nodelist {
<% [@quorum_members].flatten.each_index do |i| -%>
<% Array(@quorum_members).each_index do |i| -%>
node {
ring0_addr: <%= [@quorum_members].flatten[i] %>
<% Array(Array(@quorum_members.map{|node| Array(node).flatten})[i]).each_with_index do |addr,ring| -%>
ring<%= ring %>_addr: <%= addr %>
<% end -%>
<% if @quorum_members_ids.nil? -%>
nodeid: <%= i+1 %>
<% else -%>
Expand Down
12 changes: 7 additions & 5 deletions templates/corosync.conf.udpu.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ totem {
secauth: <%= @enable_secauth_real %>
threads: <%= @threads %>
transport: udpu
<% (0..Array(@unicast_addresses.first).length-1).each do |interface| -%>
<% Array(@unicast_addresses.first).each_index do |interface| -%>
interface {
<% @unicast_addresses.each do |addr| -%>
<% Array(Array(@unicast_addresses.map{|x| Array(x).flatten}).transpose[interface]).each do |addr| -%>
member {
memberaddr: <%= Array(addr)[interface] %>
memberaddr: <%= addr %>
}
<% end -%>
ringnumber: <%= interface %>
Expand Down Expand Up @@ -88,9 +88,11 @@ quorum {

<% unless @votequorum_expected_votes -%>
nodelist {
<% [@quorum_members].flatten.each_index do |i| -%>
<% Array(@quorum_members).each_index do |i| -%>
node {
ring0_addr: <%= [@quorum_members].flatten[i] %>
<% Array(Array(@quorum_members.map{|node| Array(node).flatten})[i]).each_with_index do |addr,ring| -%>
ring<%= ring %>_addr: <%= addr %>
<% end -%>
<% if @quorum_members_ids.nil? -%>
nodeid: <%= i+1 %>
<% else -%>
Expand Down

2 comments on commit 2eef8be

@rhamon
Copy link
Author

@rhamon rhamon commented on 2eef8be Aug 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A thing of beauty! Thanks!

@roidelapluie
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you will upgrade your internal Puppet version you will be able to catch up with the release 5.0.0 of this module.

Please sign in to comment.