How Do Build and Release Engineers Target Specific Servers With Jenkins Builds?

Problem scenario:  Using a configuration management tool, you can modify the selections of servers for your configurations to exclude specific servers.  With Puppet Master you can create classes of nodes (that exclude various Puppet Agent servers) and have manifests apply to the class.  In Puppet you can also write manifests that specify individual servers.  Chef recipes can target certain Chef clients and exclude others.  SaltStack allows the Salt Master server to "call a highstate" (or run an action) on specific Salt Minion servers to push down files or execute commands while ignoring multiple Salt Minions.  Ansible playbooks can be ran with an --extra-vars flag to limit the target servers that receive the configuration changes.   

How do you do this in Jenkins?

Solution:  The first part of the solution is to configure nodes so Jenkins master is configured to communicate with the servers you want to target.  (There used to be an external page that was helpful here: .)

Contrary to what the content of link says, you may need to install Jenkins on Windows servers if your Jenkins master is running on Linux.   Homogeneous operating systems or having your Jenkins run on Windows will obviate the need for you to install Jenkins on slave machines.  There are other ways, but installing Jenkins on the Windows servers can help you securely deploy from the Jenkins server running on Linux.

The second part of the solution happens when you are creating a new build.  When you create a job in Jenkins (e.g., New Item -> Freestyle Project -> ...) click "Restrict where this project can be run."  In the field that appears below it, enter the label of the node (e.g., it may be an IP address but it depends on what you entered when you configured Jenkins to manage the node).  

Create the build as you normally would, and it will only run on the servers that you restricted it to run on.

Leave a comment

Your email address will not be published. Required fields are marked *