2016-04-13 19:52:10 +02:00
|
|
|
---
|
|
|
|
- name: Get the haproxy repo key
|
2016-04-20 15:21:19 +02:00
|
|
|
apt_key: url={{ haproxy_repo_key }} state=present
|
2016-04-13 19:52:10 +02:00
|
|
|
when: haproxy_latest_release
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Define the haproxy repository
|
2016-04-20 15:21:19 +02:00
|
|
|
apt_repository: repo='{{ haproxy_ubuntu_latest_repo }}' state=present update_cache=yes
|
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_ubuntu
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Define the haproxy repository
|
|
|
|
apt_repository: repo='{{ haproxy_debian_latest_repo }}' state=present update_cache=yes
|
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_debian
|
2016-04-13 19:52:10 +02:00
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
|
|
|
apt: name=haproxy state=present default_release={{ ansible_lsb.codename }}-backports
|
|
|
|
when: not haproxy_latest_release
|
2016-04-20 15:21:19 +02:00
|
|
|
register: install_haproxy
|
2016-04-13 19:52:10 +02:00
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
|
|
|
apt: name=haproxy state=latest default_release={{ ansible_lsb.codename }}-backports-{{ haproxy_version }}
|
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_debian
|
2016-04-20 15:21:19 +02:00
|
|
|
register: install_haproxy
|
2016-04-13 19:52:10 +02:00
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Install the haproxy package
|
|
|
|
apt: name=haproxy state=latest
|
|
|
|
when:
|
|
|
|
- haproxy_latest_release
|
|
|
|
- is_ubuntu
|
2016-04-20 15:21:19 +02:00
|
|
|
register: install_haproxy
|
2016-04-13 19:52:10 +02:00
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Ensure that haproxy is enabled and started
|
2016-04-20 15:21:19 +02:00
|
|
|
service: name=haproxy state=started enabled=yes
|
2016-04-13 19:52:10 +02:00
|
|
|
when: haproxy_enabled
|
|
|
|
ignore_errors: True
|
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Haproxy puts a new rsyslog directive. Restart rsyslog to activate it. Reload is not sufficient
|
|
|
|
service: name=rsyslog state=restarted
|
2016-04-20 15:21:19 +02:00
|
|
|
when:
|
|
|
|
- haproxy_enabled
|
|
|
|
- ( install_haproxy | changed )
|
2016-04-13 19:52:10 +02:00
|
|
|
tags: haproxy
|
|
|
|
|
|
|
|
- name: Ensure that haproxy is stopped and disabled if needed
|
|
|
|
service: name=haproxy state=stopped enabled=no
|
|
|
|
when: not haproxy_enabled
|
|
|
|
tags: haproxy
|