Files
convert-images-for-web/roles/haproxy/tasks/main.yml
2019-04-08 10:53:13 -04:00

35 lines
720 B
YAML

---
- name: Install haproxy
command: >
bash -c "apt-get update -qq
apt-get install -y -qq haproxy"
become: true
- name: Copy haproxy config
template:
src: ../roles/haproxy/templates/haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
register: haproxy_cfg
become: true
- name: Set haproxy.cfg permissions
file:
path: /etc/haproxy/haproxy.cfg
mode: 0644
become: true
- name: Set haproxy as enabled
lineinfile:
path: /etc/default/haproxy
regexp: '^ENABLED='
line: 'ENABLED=1'
become: true
- name: Restart haproxy if /etc/haproxy/haproxy.cfg or /etc/default/haproxy changes.
service:
name: haproxy
state: restarted
when: haproxy_cfg.changed
become: true