Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 12 commits behind jordansissel:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
README.rdoc
unmanaged-notify-puppet25.pp
unmanaged-notify-puppet26.pp

README.rdoc

Unmanaged files and notification

A common question in the #puppet irc channel on freenode is: “How can I have puppet notify a service when I manually update a file?”

While I believe this “manual update” portion is an antipattern, in some cases (development server, whatever) it is desirable, and frankly I don't know your infrastructure and I don't know all of your motives, so it's worth showing how this is done :)

The code in this directory implements it. The gist of it is that you have puppet copy a local file and notify when that copy occurs.

Running it

# Start fresh:
% rm -f /tmp/flag /tmp/original

% echo "foo" > /tmp/original
% puppet apply unmanaged-notify.pp
notice: /Stage[main]//File[/tmp/flag]/ensure: defined content as '{md5}d3b07384d113edec49eaa6238ad5ff00'
notice: /Stage[main]//Exec[hello world]: Triggered 'refresh' from 1 events

# Run it again with no changes, no notify should happen:
% puppet apply unmanaged-notify.pp
<no output>

# Now change /tmp/original again
% echo "bar" > /tmp/original   
% puppet apply unmanaged-notify.pp
notice: /Stage[main]//File[/tmp/flag]/content: content changed '{md5}d3b07384d113edec49eaa6238ad5ff00' to '{md5}c157a79031e1c40f85931829bc5fc552'
notice: /Stage[main]//Exec[hello world]: Triggered 'refresh' from 1 events
Something went wrong with that request. Please try again.