2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Get the haproxy repo key
|
|
|
|
apt_key: url=http://haproxy.debian.net/bernat.debian.org.gpg state=present
|
|
|
|
when: haproxy_latest_release
|
|
|
|
register: haproxy_repo
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Define the haproxy repository
|
2015-10-23 16:03:11 +02:00
|
|
|
apt_repository: repo='{{ haproxy_latest_repo }}' state=present update_cache=yes
|
2015-05-28 11:32:57 +02:00
|
|
|
when: haproxy_latest_release
|
|
|
|
register: haproxy_repo
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
2015-05-31 19:35:38 +02:00
|
|
|
apt: name=haproxy state=present default_release={{ ansible_lsb.codename }}-backports
|
2015-05-28 11:32:57 +02:00
|
|
|
when: not haproxy_latest_release
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
2015-05-31 19:35:38 +02:00
|
|
|
apt: name=haproxy state=latest default_release={{ ansible_lsb.codename }}-backports-{{ haproxy_version }}
|
2015-10-23 16:03:11 +02:00
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_debian
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
|
|
|
apt: name=haproxy state=latest
|
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_ubuntu
|
2015-05-28 11:32:57 +02:00
|
|
|
tags: haproxy
|
2015-07-13 14:17:42 +02:00
|
|
|
|
|
|
|
- name: Ensure that haproxy is enabled and started
|
2015-12-16 13:50:18 +01:00
|
|
|
service: name=haproxy state=restarted enabled=yes
|
2015-07-13 14:17:42 +02:00
|
|
|
when: haproxy_enabled
|
|
|
|
ignore_errors: True
|
|
|
|
tags: haproxy
|
|
|
|
|
2015-12-11 16:43:53 +01:00
|
|
|
- name: Haproxy puts a new rsyslog directive. Reload rsyslog to activate it
|
|
|
|
service: name=rsyslog state=reloaded
|
|
|
|
when: haproxy_enabled
|
|
|
|
tags: haproxy
|
|
|
|
|
2015-07-13 14:17:42 +02:00
|
|
|
- name: Ensure that haproxy is stopped and disabled if needed
|
|
|
|
service: name=haproxy state=stopped enabled=no
|
|
|
|
when: not haproxy_enabled
|
|
|
|
tags: haproxy
|