From 9f172965ac8635d386124ab030f4b7942db93064 Mon Sep 17 00:00:00 2001 From: jmgao Date: Sun, 10 Jun 2018 00:16:20 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=E5=8F=96=E6=B6=88lb=E7=BB=84=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/lb/defaults/main.yml | 2 +- roles/lb/templates/haproxy.cfg.j2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/lb/defaults/main.yml b/roles/lb/defaults/main.yml index 9b3af5e..f4dc983 100644 --- a/roles/lb/defaults/main.yml +++ b/roles/lb/defaults/main.yml @@ -1,4 +1,4 @@ # 区分多个instance的VRRP组播,同网段不能重复,取值在0-255之间 # 可以直接指定数字,如ROUTER_ID=59 # 本项目取100~200间的随机数 -ROUTER_ID: {{ 200 | random(100,1) }} +ROUTER_ID: "{{ 200 | random(100,1) }}" diff --git a/roles/lb/templates/haproxy.cfg.j2 b/roles/lb/templates/haproxy.cfg.j2 index 8824d65..2ce2d48 100644 --- a/roles/lb/templates/haproxy.cfg.j2 +++ b/roles/lb/templates/haproxy.cfg.j2 @@ -20,9 +20,9 @@ listen kube-master mode tcp option tcplog balance source - {% for host in groups.kube-master %} + {% for host in groups['kube-master'] %} server {{host.inventory_hostname}} {{host.inventory_hostname}}:6443 check inter 2000 fall 2 rise 2 weight 1 {% endfor %} - {% for host in groups.new-master %} + {% for host in groups['new-master'] %} server {{host.inventory_hostname}} {{host.inventory_hostname}}:6443 check inter 2000 fall 2 rise 2 weight 1 {% endfor %}