Jedrzej Nowak 1b28b8f3c4 Change resources structure to match repository one
Change-Id: Ie8d8c092e64890af2f0886303ef3f16752ba5b76
2015-12-18 18:01:20 +01:00

23 lines
814 B
YAML

# TODO
- hosts: [{{host}}]
sudo: yes
vars:
config_dir: {src: {{ config_dir['src'] }}, dst: {{ config_dir['dst'] }}}
haproxy_ip: {{ ip }}
haproxy_services:
{% for single in config %}
- name: {{ single['name'] }}
listen_port: {{ single['listen_port'] }}
protocol: {{ single['protocol'] }}
servers:
{% for backend in single['backends'] %}
- name: {{ backend['server'] }}_{{ backend['port'] }}
ip: {{ backend['server'] }}
port: {{ backend['port'] }}
{% endfor %}
{% endfor %}
tasks:
- file: path={{ config_dir['src'] }}/ state=directory
- file: path={{ config_dir['src'] }}/haproxy.cfg state=touch
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg