diff --git a/roles/proxy/tasks/main.yml b/roles/proxy/tasks/main.yml new file mode 100644 index 0000000..72163c0 --- /dev/null +++ b/roles/proxy/tasks/main.yml @@ -0,0 +1,14 @@ +--- +#This playbook will install haproxy and configure for rails servers +# +- name: update apt cache + apt: update_cache=yes cache_valid_time=3600 + +- name: install haproxy + apt: name=haproxy state=present + +- name: Create haproxy config file + template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg + +- name: Restart haproxy + service: name=haproxy state=restarted diff --git a/roles/proxy/templates/haproxy.cfg.j2 b/roles/proxy/templates/haproxy.cfg.j2 index 459c9b9..1997f6a 100644 --- a/roles/proxy/templates/haproxy.cfg.j2 +++ b/roles/proxy/templates/haproxy.cfg.j2 @@ -21,7 +21,7 @@ listen mysql-cluster mode tcp option mysql-check user haproxy_check balance roundrobin - {% for db_server in db-internal-ips %} + {% for db_server in masterdb-internal %} server {{ db_server }} {{ db_server }}:3306 check {% endfor %}