From 7ac7a50225488cb9a944dd365bfd3763a94f1ad3 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 5 Aug 2020 19:33:53 +0200 Subject: [PATCH] Install haproxyctl and haproxy-log-analysis when requested. --- defaults/main.yml | 5 +++++ tasks/haproxy-service.yml | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c6d936c..10391b3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,6 +17,11 @@ haproxy_admin_socket: /run/haproxy/admin.sock haproxy_letsencrypt_managed: True haproxy_cert_dir: '{{ pki_dir }}/haproxy' +haproxy_install_additional_pkgs: False +haproxy_additional_pkgs: + - haproxyctl + - haproxy-log-analysis + haproxy_nagios_check: False # It's a percentage haproxy_nagios_check_w: 70 diff --git a/tasks/haproxy-service.yml b/tasks/haproxy-service.yml index d310add..aff688b 100644 --- a/tasks/haproxy-service.yml +++ b/tasks/haproxy-service.yml @@ -8,14 +8,14 @@ apt_repository: repo='{{ haproxy_ubuntu_latest_repo }}' state=present update_cache=yes when: - haproxy_latest_release - - is_ubuntu + - ansible_distribution == "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 + - ansible_distribution == "Debian" tags: haproxy - name: Install the haproxy package @@ -28,7 +28,7 @@ apt: name=haproxy state=latest default_release={{ ansible_lsb.codename }}-backports-{{ haproxy_version }} update_cache=yes cache_valid_time=3600 when: - haproxy_latest_release - - is_debian + - ansible_distribution == "Debian" register: install_haproxy tags: haproxy @@ -36,10 +36,14 @@ apt: name=haproxy state=latest update_cache=yes cache_valid_time=3600 when: - haproxy_latest_release - - is_ubuntu + - ansible_distribution == "Ubuntu" register: install_haproxy tags: haproxy +- name: Install some additional packages + apt: name={{ haproxy_additional_pkgs }} state=latest update_cache=yes cache_valid_time=3600 + when: haproxy_install_additional_pkgs + - name: Enable kernel binding non local IP addresses sysctl: name={{ item }} value=1 reload=yes state=present with_items: