Ask Your Question
0

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

asked 2018-04-20 10:28:50 -0500

nadish gravatar image

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 flag offensive close merge delete

Comments

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)

Mr_Sharma gravatar imageMr_Sharma ( 2018-04-21 08:35:53 -0500 )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.

ffalor gravatar imageffalor ( 2018-04-24 08:27:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-04-24 02:25:42 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-04-20 10:28:50 -0500

Seen: 53 times

Last updated: Apr 24