mirror of https://github.com/easzlab/kubeasz.git
# 判断服务状态直接使用systemctl is-active;避免使用grep
parent
bbed72b9f3
commit
88ba5ec455
|
@ -41,9 +41,9 @@
|
||||||
tags: restart_chronyd
|
tags: restart_chronyd
|
||||||
|
|
||||||
- name: 以轮询的方式等待chronyd服务启动
|
- name: 以轮询的方式等待chronyd服务启动
|
||||||
shell: "systemctl status chronyd.service|grep Active"
|
shell: "systemctl is-active chronyd.service"
|
||||||
register: svc_status
|
register: svc_status
|
||||||
until: '"running" in svc_status.stdout'
|
until: '"active" in svc_status.stdout'
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: restart_chronyd
|
tags: restart_chronyd
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
service: name=etcd state=restarted
|
service: name=etcd state=restarted
|
||||||
|
|
||||||
- name: 以轮询的方式等待服务同步完成
|
- name: 以轮询的方式等待服务同步完成
|
||||||
shell: "systemctl status etcd.service|grep Active"
|
shell: "systemctl is-active etcd.service"
|
||||||
register: etcd_status
|
register: etcd_status
|
||||||
until: '"running" in etcd_status.stdout'
|
until: '"active" in etcd_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 8
|
delay: 8
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
- name: 获取是否已经安装docker
|
- name: 获取是否已经安装docker
|
||||||
shell: 'systemctl status docker|grep Active || echo "NOT FOUND"'
|
shell: 'systemctl is-active docker || echo "NOT FOUND"'
|
||||||
register: docker_status
|
register: docker_status
|
||||||
|
|
||||||
- name: WARNNING 提示
|
- name: WARNNING 提示
|
||||||
debug:
|
debug:
|
||||||
msg: "[WARN]: docker is running, and containerd will be installed"
|
msg: "[WARN]: docker is running, and containerd will be installed"
|
||||||
when: '"running" in docker_status.stdout'
|
when: '"active" in docker_status.stdout'
|
||||||
|
|
||||||
- name: 获取是否已经安装containerd
|
- name: 获取是否已经安装containerd
|
||||||
shell: 'systemctl status containerd|grep Active || echo "NoFound"'
|
shell: 'systemctl is-active containerd || echo "NoFound"'
|
||||||
register: containerd_svc
|
register: containerd_svc
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
@ -53,9 +53,9 @@
|
||||||
tags: upgrade
|
tags: upgrade
|
||||||
|
|
||||||
- name: 轮询等待containerd服务运行
|
- name: 轮询等待containerd服务运行
|
||||||
shell: "systemctl status containerd.service|grep Active"
|
shell: "systemctl is-active containerd.service"
|
||||||
register: containerd_status
|
register: containerd_status
|
||||||
until: '"running" in containerd_status.stdout'
|
until: '"active" in containerd_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 2
|
delay: 2
|
||||||
tags: upgrade
|
tags: upgrade
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
- name: 获取是否已经安装docker
|
- name: 获取是否已经安装docker
|
||||||
shell: 'systemctl status docker|grep Active || echo "NoFound"'
|
shell: 'systemctl is-active docker || echo "NoFound"'
|
||||||
register: docker_svc
|
register: docker_svc
|
||||||
|
|
||||||
- name: 获取是否已经安装containerd
|
- name: 获取是否已经安装containerd
|
||||||
shell: 'systemctl status containerd|grep Active || echo "NoFound"'
|
shell: 'systemctl is-active containerd || echo "NoFound"'
|
||||||
register: containerd_svc
|
register: containerd_svc
|
||||||
|
|
||||||
# 18.09.x 版本二进制名字有变化,需要做判断
|
# 18.09.x 版本二进制名字有变化,需要做判断
|
||||||
|
@ -102,9 +102,9 @@
|
||||||
tags: upgrade_docker
|
tags: upgrade_docker
|
||||||
|
|
||||||
- name: 轮询等待docker服务运行
|
- name: 轮询等待docker服务运行
|
||||||
shell: "systemctl status docker.service|grep Active"
|
shell: "systemctl is-active docker.service"
|
||||||
register: docker_status
|
register: docker_status
|
||||||
until: '"running" in docker_status.stdout'
|
until: '"active" in docker_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 2
|
delay: 2
|
||||||
tags: upgrade_docker
|
tags: upgrade_docker
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
tags: upgrade_etcd, restart_etcd
|
tags: upgrade_etcd, restart_etcd
|
||||||
|
|
||||||
- name: 以轮询的方式等待服务同步完成
|
- name: 以轮询的方式等待服务同步完成
|
||||||
shell: "systemctl status etcd.service|grep Active"
|
shell: "systemctl is-active etcd.service"
|
||||||
register: etcd_status
|
register: etcd_status
|
||||||
until: '"running" in etcd_status.stdout'
|
until: '"active" in etcd_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 8
|
delay: 8
|
||||||
tags: upgrade_etcd, restart_etcd
|
tags: upgrade_etcd, restart_etcd
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
|
||||||
- name: 以轮询的方式等待l4lb服务启动
|
- name: 以轮询的方式等待l4lb服务启动
|
||||||
shell: "systemctl status l4lb.service|grep Active"
|
shell: "systemctl is-active l4lb.service"
|
||||||
register: svc_status
|
register: svc_status
|
||||||
until: '"running" in svc_status.stdout'
|
until: '"active" in svc_status.stdout'
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
@ -72,9 +72,9 @@
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
|
||||||
- name: 以轮询的方式等待keepalived服务启动
|
- name: 以轮询的方式等待keepalived服务启动
|
||||||
shell: "systemctl status keepalived.service|grep Active"
|
shell: "systemctl is-active keepalived.service"
|
||||||
register: svc_status
|
register: svc_status
|
||||||
until: '"running" in svc_status.stdout'
|
until: '"active" in svc_status.stdout'
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
tags: restart_kube-lb
|
tags: restart_kube-lb
|
||||||
|
|
||||||
- name: 以轮询的方式等待kube-lb服务启动
|
- name: 以轮询的方式等待kube-lb服务启动
|
||||||
shell: "systemctl status kube-lb.service|grep Active"
|
shell: "systemctl is-active kube-lb.service"
|
||||||
register: svc_status
|
register: svc_status
|
||||||
until: '"running" in svc_status.stdout'
|
until: '"active" in svc_status.stdout'
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: restart_kube-lb
|
tags: restart_kube-lb
|
||||||
|
|
|
@ -86,27 +86,27 @@
|
||||||
|
|
||||||
# 轮询等待kube-apiserver启动完成
|
# 轮询等待kube-apiserver启动完成
|
||||||
- name: 轮询等待kube-apiserver启动
|
- name: 轮询等待kube-apiserver启动
|
||||||
shell: "systemctl status kube-apiserver.service|grep Active"
|
shell: "systemctl is-active kube-apiserver.service"
|
||||||
register: api_status
|
register: api_status
|
||||||
until: '"running" in api_status.stdout'
|
until: '"active" in api_status.stdout'
|
||||||
retries: 10
|
retries: 10
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: upgrade_k8s, restart_master
|
tags: upgrade_k8s, restart_master
|
||||||
|
|
||||||
# 轮询等待kube-controller-manager启动完成
|
# 轮询等待kube-controller-manager启动完成
|
||||||
- name: 轮询等待kube-controller-manager启动
|
- name: 轮询等待kube-controller-manager启动
|
||||||
shell: "systemctl status kube-controller-manager.service|grep Active"
|
shell: "systemctl is-active kube-controller-manager.service"
|
||||||
register: cm_status
|
register: cm_status
|
||||||
until: '"running" in cm_status.stdout'
|
until: '"active" in cm_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: upgrade_k8s, restart_master
|
tags: upgrade_k8s, restart_master
|
||||||
|
|
||||||
# 轮询等待kube-scheduler启动完成
|
# 轮询等待kube-scheduler启动完成
|
||||||
- name: 轮询等待kube-scheduler启动
|
- name: 轮询等待kube-scheduler启动
|
||||||
shell: "systemctl status kube-scheduler.service|grep Active"
|
shell: "systemctl is-active kube-scheduler.service"
|
||||||
register: sch_status
|
register: sch_status
|
||||||
until: '"running" in sch_status.stdout'
|
until: '"active" in sch_status.stdout'
|
||||||
retries: 8
|
retries: 8
|
||||||
delay: 3
|
delay: 3
|
||||||
tags: upgrade_k8s, restart_master
|
tags: upgrade_k8s, restart_master
|
||||||
|
|
|
@ -90,18 +90,18 @@
|
||||||
|
|
||||||
# 轮询等待kube-proxy启动完成
|
# 轮询等待kube-proxy启动完成
|
||||||
- name: 轮询等待kube-proxy启动
|
- name: 轮询等待kube-proxy启动
|
||||||
shell: "systemctl status kube-proxy.service|grep Active"
|
shell: "systemctl is-active kube-proxy.service"
|
||||||
register: kubeproxy_status
|
register: kubeproxy_status
|
||||||
until: '"running" in kubeproxy_status.stdout'
|
until: '"active" in kubeproxy_status.stdout'
|
||||||
retries: 4
|
retries: 4
|
||||||
delay: 2
|
delay: 2
|
||||||
tags: reload-kube-proxy, upgrade_k8s, restart_node
|
tags: reload-kube-proxy, upgrade_k8s, restart_node
|
||||||
|
|
||||||
# 轮询等待kubelet启动完成
|
# 轮询等待kubelet启动完成
|
||||||
- name: 轮询等待kubelet启动
|
- name: 轮询等待kubelet启动
|
||||||
shell: "systemctl status kubelet.service|grep Active"
|
shell: "systemctl is-active kubelet.service"
|
||||||
register: kubelet_status
|
register: kubelet_status
|
||||||
until: '"running" in kubelet_status.stdout'
|
until: '"active" in kubelet_status.stdout'
|
||||||
retries: 4
|
retries: 4
|
||||||
delay: 2
|
delay: 2
|
||||||
tags: reload-kube-proxy, upgrade_k8s, restart_node
|
tags: reload-kube-proxy, upgrade_k8s, restart_node
|
||||||
|
|
Loading…
Reference in New Issue