system-config/playbooks/roles/haproxy/tasks/main.yaml
Jeremy Stanley df23d48949 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
2019-07-23 16:48:23 +00:00

39 lines
897 B
YAML

- name: Install socat for haproxy management
package:
name: socat
state: present
- name: Synchronize docker-compose directory
synchronize:
src: docker/
dest: /etc/haproxy-docker/
- name: Ensure registry volume directories exists
file:
state: directory
path: "/var/haproxy/{{ item }}"
owner: 1000
group: 1000
loop:
- etc
- run
- name: Write haproxy config file
template:
src: haproxy.cfg.j2
dest: /var/haproxy/etc/haproxy.cfg
notify: Reload haproxy
- name: Install docker-compose
package:
name:
- docker-compose
state: present
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/haproxy-docker/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/haproxy-docker/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f