Il 16/12/2016 20:54, Guillaume Bourque ha scritto:
Hello Marco,

I would be very interest on how you build your harpy config, you must
have per server settings and then a global config ?


On the Ansible Control Machine the configuration is split in several files named either ".common" or in ".<node name>" (pgli01 or pmli01 in this example).

000-common.common
010-traveler.pgli01
010-traveler.pmli01
020-tesi.common
050-vip.common
070-vdi.common
080-AD.common
150-crm.common
990-stats.pgli01
990-stats.pmli01

The differences between the nodes are disseminated into the configuration: it was very difficult to mantain it with a Jinja2 template (although much more elegant).

The Ansible task assembles the configuration on the node taking the files in order (numbers) and choosing between the "common" or the node-specific one.

- name: Configure haproxy
  assemble: src=etc/haproxy remote_src=no
            regexp=(common|{{ ansible_hostname }})
            dest=/etc/haproxy/haproxy.cfg mode=644 owner=root group=root
  tags:
  - haproxyconfig
  notify:
  - Reload haproxy

Ciao

.marcoc

Reply via email to