Ask Your Question
0

print messages conditionally on resource synchronization

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

jaksky gravatar image

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

ramindk gravatar image

Hi,

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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-07-23 23:54:09 -0600

binford2k gravatar image

Puppet already prints a notification when it changes something on the system. You don't need to reinvent that.

To reboot the system when necessary, you can now use the reboot module

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: 2014-09-09 04:55:40 -0600

Seen: 313 times

Last updated: Jul 23