Skip to content

Commit

Permalink
fix: installation of ex-lb
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Mar 27, 2021
1 parent da63eee commit a631575
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 46 deletions.
47 changes: 24 additions & 23 deletions ezctl
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,19 @@ function usage-setup(){
echo -e "\033[33mUsage:\033[0m ezctl setup <cluster> <step>"
cat <<EOF
available steps:
01 prepare to prepare CA/certs & kubeconfig & other system settings
02 etcd to setup the etcd cluster
03 runtime to setup the container runtime(docker or containerd)
04 kube-master to setup the master nodes
05 kube-node to setup the worker nodes
06 network to setup the network plugin
07 cluster-addon to setup other useful plugins
all to run 01~07 all at once
harbor to install a new harbor server or to integrate with an existed one
examples: ./ezctl setup test-k8s 01
./ezctl setup test-k8s 02
01 prepare to prepare CA/certs & kubeconfig & other system settings
02 etcd to setup the etcd cluster
03 container-runtime to setup the container runtime(docker or containerd)
04 kube-master to setup the master nodes
05 kube-node to setup the worker nodes
06 network to setup the network plugin
07 cluster-addon to setup other useful plugins
90 all to run 01~07 all at once
10 ex-lb to install external loadbalance for accessing k8s from outside
11 harbor to install a new harbor server or to integrate with an existed one
examples: ./ezctl setup test-k8s 01 (or ./ezctl setup test-k8s prepare)
./ezctl setup test-k8s 02 (or ./ezctl setup test-k8s etcd)
./ezctl setup test-k8s all
EOF
}
Expand Down Expand Up @@ -185,34 +186,34 @@ function setup() {

PLAY_BOOK="dummy.yml"
case "$2" in
(01)
(01|prepare)
PLAY_BOOK="01.prepare.yml"
;;
(02)
(02|etcd)
PLAY_BOOK="02.etcd.yml"
;;
(03)
(03|container-runtime)
PLAY_BOOK="03.runtime.yml"
;;
(04)
(04|kube-master)
PLAY_BOOK="04.kube-master.yml"
;;
(05)
(05|kube-node)
PLAY_BOOK="05.kube-node.yml"
;;
(06)
(06|network)
PLAY_BOOK="06.network.yml"
;;
(07)
(07|cluster-addon)
PLAY_BOOK="07.cluster-addon.yml"
;;
(90)
(90|all)
PLAY_BOOK="90.setup.yml"
;;
(all)
PLAY_BOOK="90.setup.yml"
(10|ex-lb)
PLAY_BOOK="10.ex-lb.yml"
;;
(harbor)
(11|harbor)
PLAY_BOOK="11.harbor.yml"
;;
(*)
Expand Down
3 changes: 3 additions & 0 deletions playbooks/10.ex-lb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- hosts: ex_lb
roles:
- ex-lb
32 changes: 9 additions & 23 deletions roles/ex-lb/clean-ex-lb.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
- hosts:
- ex_lb
tasks:
- block:
- name: stop and disable chrony in Ubuntu
service: name=chrony state=stopped enabled=no
ignore_errors: true
when: 'ansible_distribution in ["Ubuntu","Debian"]'

- name: stop and disable chronyd in CentOS/RedHat
service: name=chronyd state=stopped enabled=no
ignore_errors: true
when: 'ansible_distribution in ["CentOS","RedHat","Amazon","Aliyun"]'
when: "groups['chrony']|length > 0"
- name: get service info
shell: 'systemctl list-units --type=service |grep -E "haproxy|keepalived|ssh"'
register: service_info

- name: stop keepalived service
service: name=keepalived state=stopped enabled=no
- name: remove service haproxy
service: name=haproxy state=stopped enabled=no
when: '"haproxy" in service_info.stdout'
ignore_errors: true

- name: stop haproxy service
service: name=haproxy state=stopped enabled=no
- name: remove service keepalived
service: name=keepalived state=stopped enabled=no
when: '"keepalived" in service_info.stdout'
ignore_errors: true

- name: remove files and dirs
file: name={{ item }} state=absent
with_items:
- "/etc/haproxy"
- "/etc/keepalived"

- name: clean 'ENV PATH'
lineinfile:
dest: ~/.bashrc
state: absent
regexp: '{{ item }}'
with_items:
- 'kubeasz'

0 comments on commit a631575

Please sign in to comment.