Created
October 28, 2010 07:22
-
-
Save jordansissel/650831 to your computer and use it in GitHub Desktop.
notify from a file change that is not managed by puppet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snack(~) % rm /tmp/flag | |
snack(~) % echo "Hello" > /tmp/original | |
snack(~) % sudo puppet apply unmanaged-notify.pp | |
notice: /Stage[main]//File[/tmp/flag]/ensure: defined content as '{md5}09f7e02f1290be211da707a266f153b3' | |
notice: /Stage[main]//Exec[hello world]: Triggered 'refresh' from 1 events | |
# Won't exec 'hello world' again because no change occured to /tmp/original: | |
snack(~) % sudo puppet apply unmanaged-notify.pp | |
# Now change /tmp/original: | |
snack(~) % echo "testing" > /tmp/original | |
snack(~) % sudo puppet apply unmanaged-notify.pp | |
notice: /Stage[main]//File[/tmp/flag]/content: content changed '{md5}09f7e02f1290be211da707a266f153b3' to '{md5}eb1a3227cdc3fedbaec2fe38bf6c044a' | |
notice: /Stage[main]//Exec[hello world]: Triggered 'refresh' from 1 events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Manually manage /tmp/original | |
# Each puppet run willy copy it to /tmp/flag if there's a change and notify | |
# the exec when it changes. | |
file { | |
"/tmp/flag": | |
source => "file:///tmp/original", | |
notify => Exec["hello world"]; | |
} | |
exec { | |
"hello world": | |
command => "/bin/echo hello world", | |
refreshonly => true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment