From df23d48949d6b27165fb1f3885f6e307a4c37b00 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 23 Jul 2019 16:01:59 +0000 Subject: [PATCH] Reload haproxy configuration when config changes Add an Ansible handler to send a hangup signal through docker-compose to the running haproxy daemon any time the task to update its configuration fires. Change-Id: I1946c1e7eaaa8a8e2209007b5d065dba952ec6e2 --- playbooks/roles/haproxy/handlers/main.yaml | 4 ++++ playbooks/roles/haproxy/tasks/main.yaml | 1 + 2 files changed, 5 insertions(+) create mode 100644 playbooks/roles/haproxy/handlers/main.yaml diff --git a/playbooks/roles/haproxy/handlers/main.yaml b/playbooks/roles/haproxy/handlers/main.yaml new file mode 100644 index 0000000000..9d749458e7 --- /dev/null +++ b/playbooks/roles/haproxy/handlers/main.yaml @@ -0,0 +1,4 @@ +- name: Reload haproxy + shell: + cmd: docker-compose kill -s HUP haproxy + chdir: /etc/haproxy-docker/ diff --git a/playbooks/roles/haproxy/tasks/main.yaml b/playbooks/roles/haproxy/tasks/main.yaml index f1927f8918..32523f165b 100644 --- a/playbooks/roles/haproxy/tasks/main.yaml +++ b/playbooks/roles/haproxy/tasks/main.yaml @@ -19,6 +19,7 @@ template: src: haproxy.cfg.j2 dest: /var/haproxy/etc/haproxy.cfg + notify: Reload haproxy - name: Install docker-compose package: name: