I really wonder why people go for implementing their own HA stack when there's Pacemaker or rgmanager available?
First: There's a functional resource agent available to handle PostgreSQL. It handles single instances or multiple ones.
Second: Zhe whole cluster-thing can be very complex. You can have a LOT of fail scenarios and I wouldn't recommend to anyone to try to catch them all.