Assign the role to nodes

Finally, we assign role::jenkins::controller to every node that acts as a Jenkins controller.

Puppet has several ways to assign classes to nodes, so use whichever tool you feel best fits your team. Your main choices are:

  • The console node classifier, which lets you group nodes based on their facts and assign classes to those groups.
  • The main manifest which can use node statements or conditional logic to assign classes.
  • Hiera or Puppet lookup — Use the lookup function to do a unique array merge on a special classes key, and pass the resulting array to the include function.
    # /etc/puppetlabs/code/environments/production/manifests/site.pp
    lookup('classes', {merge => unique}).include

To learn more about how to assign custom facts to individual nodes, visit Writing custom facts.