Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created October 28, 2010 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jordansissel/650831 to your computer and use it in GitHub Desktop.
Save jordansissel/650831 to your computer and use it in GitHub Desktop.
notify from a file change that is not managed by puppet
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
# 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