print messages conditionally on resource synchronization

asked 2014-09-09 04:55:40 -0500

jaksky gravatar image

updated 2014-09-09 11:12:54 -0500

ramindk gravatar image


is there a way how to print out a message based on a resource synchronization? Something like: required content of the file is following and if that is updated(synchronized) print a message e.g. Please restart the system.

I tried following

file { 'disableselinux':
  ensure => present,
  path   => '/etc/selinux/config',
  mode   => '0644',
  source => 'puppet:///modules/base/selinux',

notify { 'SElinuxChange':
  loglevel  => warning,
  message   => 'System needs restart',
  subscribe => File['disableselinux'],    

But that message will be printed every time I guess. Is there any elegant way of doing so avoiding if-then-else flags etc.

edit retag flag offensive close merge delete