You can add hubs and spokes to large Puppet Enterprise deployments for efficient load balancing and for relaying MCollective messages.
Adding hubs and spokes can be done in addition to, or independently from, adding additional masters to your infrastructure.
Install ActiveMQ hubs and spokes
Setting up hubs and spokes involves classifying nodes into appropriate node groups, and then configuring the connections for those node groups.
Install the agent on ActiveMQ hub and spoke nodes
Hub and spoke nodes must have an agent installed.
Create the ActiveMQ hub group
Create the ActiveMQ hub group and pin the hub node to the group.
Add spokes to ActiveMQ broker group
Add spoke nodes to the PE ActiveMQ Broker group, which is a preconfigured node group.
Create a custom fact for node and spoke relationships
In a hub and spoke configuration, all the nodes other than infrastructure nodes use the most suitable spoke as their broker. You create these connections with custom facts.
Suitable spokes are usually those that share a geographic location or share network segments. In some circumstance the spokes may also be behind a load balancer.
For example, create a custom fact that represents a Sydney data center.
-
*nix
puppet apply -e 'file { ["/etc/puppetlabs", "/etc/puppetlabs/facter", "/etc/puppetlabs/facter/facts.d"]: ensure => directory }' puppet apply -e 'file {"/etc/puppetlabs/facter/facts.d/data_center.txt": ensure => file, content => "data_center=syd"}
-
Windows
puppet apply -e "file { ['C:/ProgramData/PuppetLabs', 'C:/ProgramData/PuppetLabs/facter', 'C:/ProgramData/PuppetLabs/facter/facts.d']: ensure => directory }" puppet apply -e "file {'C:/ProgramData/PuppetLabs/facter/facts.d/data_center.txt': ensure => file, content => 'data_center=syd'}"
Classify the ActiveMQ spokes
Use custom facts to classify spokes in the console or to bind agents to spokes with Hiera.
Classify the ActiveMQ spokes with the console
Use the console to create new node groups for each spoke or group of spokes in your infrastructure.
Groups must belong to the PE MCollective group, and include the puppet_enterprise::profile::mcollective::agent
class, with the activemq_brokers
parameter set to the name of the desired spokes.
Classify the ActiveMQ spokes with Hiera
If you do not want to use the console to create new node groups for each spoke or groups of spokes in your infrastructure, you can use Hiera with automatic data binding instead.
You must remove the mcollective_middleware_hosts parameter
from the puppet_enterprise
class in the PE Infrastructure group, and place this parameter within Hiera at the appropriate level to distinguish the different spokes.
Verify connections in your infrastructure
Check that ActiveMQ hub and spokes are configured correctly.