Reduce template code duplication

The listen template is essentially just a combination of frontend/backends in haproxy, and lots of code was duplicated between the three templates. This commit moves the stanzas into fragments.