PostgreSQL Automatic Failover (Trigger File Creation)?
repmgr 2.0 supports automatic failover.

However, I strongly advise you not to use automatic failover. It's generally a much better idea to use manually triggered automated failover, where the failover process is scripted/automated, but a human has to say "Yup, master's dead, do it".

If you do use automatic failover you need to make it a routine part of your operations, where you test it regularly. Otherwise it will bite you when you least expect it and can least afford it.

It is also vital that you consider fencing/STONITH as part of your failover solution, to prevent two diverging masters.