From ecf1d280033921a7e25aefa41d451c142661901f Mon Sep 17 00:00:00 2001 From: gjmzj Date: Sun, 24 Nov 2019 13:30:31 +0000 Subject: [PATCH] =?UTF-8?q?fix=20ubuntu1804=E5=AE=89=E8=A3=85ex-lb?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/ex-lb/tasks/main.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/roles/ex-lb/tasks/main.yml b/roles/ex-lb/tasks/main.yml index 2b8a88c..a448285 100644 --- a/roles/ex-lb/tasks/main.yml +++ b/roles/ex-lb/tasks/main.yml @@ -19,22 +19,6 @@ - /etc/haproxy - /etc/keepalived -- name: 安装 haproxy+keepalived - package: name={{ item }} state=present - with_items: - - haproxy - - keepalived - when: 'INSTALL_SOURCE != "offline"' - -# 离线安装 haproxy+keepalived -- import_tasks: offline.yml - when: 'INSTALL_SOURCE == "offline"' - -- name: 修改centos的haproxy.service - template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service - when: 'ansible_distribution in ["CentOS","RedHat","Amazon"]' - tags: restart_lb - - name: 配置 haproxy template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg tags: restart_lb @@ -49,6 +33,23 @@ when: LB_ROLE == "backup" tags: restart_lb +- name: 安装 haproxy+keepalived + package: name={{ item }} state=present + with_items: + - haproxy + - keepalived + when: 'INSTALL_SOURCE != "offline"' + ignore_errors: true + +# 离线安装 haproxy+keepalived +- import_tasks: offline.yml + when: 'INSTALL_SOURCE == "offline"' + +- name: 修改centos的haproxy.service + template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service + when: 'ansible_distribution in ["CentOS","RedHat","Amazon"]' + tags: restart_lb + - name: daemon-reload for haproxy.service shell: systemctl daemon-reload tags: restart_lb