From b77adf3061d51968e3fe7463edc5c8fd55cc5731 Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Wed, 22 Apr 2015 17:30:01 +0300 Subject: [PATCH] Restart haproxy after config update --- examples/resources/simple/haproxy/run.yml | 6 ++++++ examples/resources/templates/haproxy.cfg.j2 | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/resources/simple/haproxy/run.yml b/examples/resources/simple/haproxy/run.yml index fa09fc6..6d01b7d 100644 --- a/examples/resources/simple/haproxy/run.yml +++ b/examples/resources/simple/haproxy/run.yml @@ -9,9 +9,15 @@ - file: state=directory path=/etc/solar/{{name}} # TODO Remove hardcoded path - template: src=/vagrant/examples/resources/templates/haproxy.cfg.j2 dest=/etc/solar/{{name}}/haproxy.cfg backup=yes + notify: + - haproxy_reload_config - shell: docker run -d \ --net="host" \ --privileged \ -v /etc/solar/{{name}}/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \ --name {{name}} {{image}} when: is_running|failed + + handlers: + - name: haproxy_reload_config + shell: docker restart {{name}} diff --git a/examples/resources/templates/haproxy.cfg.j2 b/examples/resources/templates/haproxy.cfg.j2 index 8bdb826..5f14c9a 100644 --- a/examples/resources/templates/haproxy.cfg.j2 +++ b/examples/resources/templates/haproxy.cfg.j2 @@ -1,6 +1,6 @@ global maxconn 4096 - pidfile /var/run/haproxy.pidfile + pidfile /var/run/haproxy.pid defaults mode tcp timeout connect 5s