From f26aba455cd6a2719d52acd589e116e0492e2e2f Mon Sep 17 00:00:00 2001 From: jmgao Date: Tue, 1 Oct 2019 22:32:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=B4=E6=97=B6=E5=90=AF?= =?UTF-8?q?=E5=81=9C=E9=9B=86=E7=BE=A4=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 91.start.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 92.stop.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 91.start.yml create mode 100644 92.stop.yml diff --git a/91.start.yml b/91.start.yml new file mode 100644 index 0000000..2df0787 --- /dev/null +++ b/91.start.yml @@ -0,0 +1,45 @@ +- hosts: etcd + tasks: + - name: starting etcd cluster + service: name=etcd state=started enabled=yes + +- hosts: kube-master + tasks: + - name: starting kube-master services + service: name={{ item }} state=started enabled=yes + with_items: + - kube-apiserver + - kube-controller-manager + - kube-scheduler + +- hosts: + - kube-master + - kube-node + tasks: + - name: starting docker + service: name=docker state=started enabled=yes + when: "CONTAINER_RUNTIME == 'docker'" + + - name: starting containerd + service: name=containerd state=started enabled=yes + when: "CONTAINER_RUNTIME == 'containerd'" + + - name: starting haproxy on kube-node + service: name=haproxy state=started enabled=yes + when: + - "inventory_hostname not in groups['kube-master']" + - "groups['kube-master']|length > 1" + + - name: starting kube-node services + service: name={{ item }} state=started enabled=yes + with_items: + - kubelet + - kube-proxy + +- hosts: ex-lb + tasks: + - name: starting external loadbalance + service: name={{ item }} state=started enabled=yes + with_items: + - haproxy + - keepalived diff --git a/92.stop.yml b/92.stop.yml new file mode 100644 index 0000000..8cb7ab9 --- /dev/null +++ b/92.stop.yml @@ -0,0 +1,45 @@ +- hosts: kube-master + tasks: + - name: stopping kube-master services + service: name={{ item }} state=stopped enabled=no + with_items: + - kube-apiserver + - kube-controller-manager + - kube-scheduler + +- hosts: etcd + tasks: + - name: stopping etcd cluster + service: name=etcd state=stopped enabled=no + +- hosts: ex-lb + tasks: + - name: stopping external loadbalance + service: name={{ item }} state=stopped enabled=no + with_items: + - haproxy + - keepalived + +- hosts: + - kube-master + - kube-node + tasks: + - name: stopping haproxy on kube-node + service: name=haproxy state=stopped enabled=no + when: + - "inventory_hostname not in groups['kube-master']" + - "groups['kube-master']|length > 1" + + - name: stopping kube-node services + service: name={{ item }} state=stopped enabled=no + with_items: + - kubelet + - kube-proxy + + - name: stopping docker + service: name=docker state=stopped enabled=no + when: "CONTAINER_RUNTIME == 'docker'" + + - name: stopping containerd + service: name=containerd state=stopped enabled=no + when: "CONTAINER_RUNTIME == 'containerd'"