Like many small teams, Needle uses 37signals’ Campfire chat platform for collaborating online. Along with messages exchanged between coworkers, we also use Campfire for announcing new git commits, jira tickets and successful application deployments.
Since the code I’ve been using to send messages from Chef recipes to Campfire is virtually identical between a number of our cookbooks, I decided to turn that code into a LWRP that anyone can use in their own recipes. The cookbook for this LWRP is available on github.
Requirements
- a Campfire API token (these are unique to each Campfire user, so if you want your messages to come from a particular user, get their token)
- the
tinder
gem (installed by thecampfire::default
recipe)
Attributes
subdomain
- the subdomain for your Campfire instance (required)room
- the name of the room you would like to speak into (requied)token
- authentication token for your Campfire account (required)message
- the message to speak. If a message is not specified, the name of thecampfire_msg
resource is used.paste
- toggles whether or not to send the message as a monospaced “paste” (defaults to false)play_before
- play the specified sound before speaking the messageplay_after
- play the specified sound after speaking the messagefailure_ok
- toggles whether or not to catch the exception if an error is encountered connecting to Campfire (defaults to true)
A list of emoji and sounds available in Campfire can be found here: http://www.emoji-cheat-sheet.com/
Usage examples
1 2 3 4 5 6 7 8 9 |
|