From 5f0e4b24e817eb499141f5eb8f5863587f4f70d4 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 2 Feb 2016 08:55:27 -0500 Subject: [PATCH] Template created to install haproxy --- roles/proxy/tasks/main.yml | 14 ++++++++++++++ roles/proxy/templates/haproxy.cfg.j2 | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 roles/proxy/tasks/main.yml 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 %}