bbaugher/serf — pull request #25 by maratoid (2014-06-11 00:08:18+00:00)
Title: support for multiple agent installation, Serf LWRP

This PR will allow for running multiple serf agents of different bind/rpc addresses. I've updated the README with explanation of changes. It adds a Serf LWRP which is used by the updated default recipe.

This will not require any changes from users of the cookbook who are not running multiple clusters on one box.

You can verify by:
```
kitchen converge multiagent-ubuntu-1204
kitchen login multiagent-ubuntu-1204
```

then:

```
vagrant@multiagent-ubuntu-1204:~$ serf members -rpc-addr="127.0.0.1:7373"
first_agent 10.0.2.15:7946 alive
vagrant@multiagent-ubuntu-1204:~$ serf members -rpc-addr="127.0.0.1:7372"
second_agent 10.0.2.15:7945 alive
vagrant@multiagent-ubuntu-1204:~$ serf members -rpc-addr="127.0.0.1:7371"
third_agent 10.0.2.15:7944 alive
```

joining two agents:

```
vagrant@multiagent-ubuntu-1204:~$ serf join "0.0.0.0:7945" -rpc-addr="127.0.0.1:7373"
Successfully joined cluster by contacting 1 nodes.
vagrant@multiagent-ubuntu-1204:~$ serf members -rpc-addr="127.0.0.1:7373"
first_agent 10.0.2.15:7946 alive
second_agent 10.0.2.15:7945 alive
```

send an event to one agent, handled by a downloaded event handler:
```
serf event -rpc-addr="127.0.0.1:7371" rvm3
Event 'rvm3' dispatched! Coalescing enabled: true
vagrant@multiagent-ubuntu-1204:~$ cat /opt/serf/logs/agent_3.log
==> Starting Serf agent...
==> Starting Serf agent RPC...
==> Serf agent running!
Node name: 'third_agent'
Bind addr: '0.0.0.0:7944'
RPC addr: '127.0.0.1:7371'
Encrypted: false
Snapshot: false
Profile: lan

==> Log data will now stream in as it occurs:

2014/06/10 23:52:27 [INFO] agent: Serf agent starting
2014/06/10 23:52:27 [INFO] serf: EventMemberJoin: third_agent 10.0.2.15
2014/06/10 23:52:28 [INFO] agent: Received event: member-join
2014/06/10 23:56:36 [INFO] agent.ipc: Accepted client: 127.0.0.1:41617
2014/06/11 00:06:06 [INFO] agent.ipc: Accepted client: 127.0.0.1:41619
2014/06/11 00:06:06 [DEBUG] agent: Requesting user event send: rvm3. Coalesced: true. Payload: ""
2014/06/11 00:06:07 [INFO] agent: Received event: user-event: rvm3
2014/06/11 00:06:07 [DEBUG] agent: Event 'user' script output: mkdir: cannot create directory `//.rvm': Permission denied
2014/06/11 00:06:07 [ERR] agent: Error invoking script '/opt/serf/event_handlers/agent_3/rvm-installer': exit status 1
```

Hopefully this is cleaner than my last attempt.