# Puppet: upgrade a software on node1 and keep the current version on node2

Two nodes belong to the same node group and hence they both have same rules configured. The rule basically will install software in both the nodes. I want to upgrade a software on one node and do nothing on the another node ie make no changes to current installed software version. Is there any way to do this?

edit retag close merge delete

How about: 1. Untag node2, deploy, tag node2 or, 2. Use basic fact say IPaddress to roll out the updates. can be used as if-else condition. (If making changes in code is feasible)

( 2018-04-21 08:35:53 -0600 )edit
1

Example42 has the correct answer. You should use heira for all your data if you can(if it makes sense). It allows flexibility. For example I have one class that enforces all services. The services differ by domain, node, etc. But I only have one profile for services. One puppet code.

( 2018-04-24 08:27:56 -0600 )edit

Sort by » oldest newest most voted

If you use hiera you can manage the version of a package on the relevant hiera data (in this case it would be for the specific node).

In order to manage the version via hiera you need to expose it as a parameter in the class where the package is installed.

For example:

class my_app (
$ensure = present, ) { package { 'my_app': ensure =>$ensure,
}
}


And on hiera data, assuming you are using the default yaml backend in a file like hieradata/nodes/my_node.yaml (path of the file depends on your hiera.yaml configuration) have something like:

my_app::ensure: 3.1


Note that this approach is useful also for removing a package from a node, it's enough to place data like:

my_app::ensure: absent


If instead you classify and configure nodes only via PE console, then you have to create a new node group, make the original one parent of this node one, move here the node where you want a different package version and include there the class my_app setting the parameter ensure with the version you want.

In any case, if you need to manage the version of a package in some way, that information has to be expressed by some variable, and the sanest way to do that is to expose that variable as a parameter of the class where the package is declared.

more