Get pubsub nodes from puppetdb
authorPeter Palfrader <peter@palfrader.org>
Sat, 28 Sep 2019 08:23:26 +0000 (10:23 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sat, 28 Sep 2019 08:23:26 +0000 (10:23 +0200)
modules/roles/manifests/pubsub.pp

index 1312a4b..20554ec 100644 (file)
@@ -4,15 +4,13 @@ class roles::pubsub {
 
   $cluster_cookie  = $roles::pubsub::params::cluster_cookie
 
-  $cc_master       = rainier
-  $cc_secondary    = rapoport
+  # Get the fact named hostname from all nodes in puppetdb with class Roles::Pubsub
+  $query = 'facts { name = "hostname" and resources { type = "Class" and title = "Roles::Pubsub" } }'
+  $cluster_nodes = sort(puppetdb_query($query).map |$value| { $value["value"] })
 
   class { 'rabbitmq':
     config_cluster    => true,
-    cluster_nodes     => [
-      $cc_master,
-      $cc_secondary,
-    ],
+    cluster_nodes     => $cluster_nodes,
     cluster_node_type => 'disc',
     erlang_cookie     => '8r17so6o1s124ns49sr08n0o24342160',
     delete_guest_user => true,