修复shell执行systemctl enable xx可能报错退出问题

pull/164/head
gjmzj 2018-04-10 18:33:24 +08:00
parent b176a8761d
commit 6eb58b175a
6 changed files with 32 additions and 7 deletions

View File

@ -4,7 +4,7 @@
- name: 配置 haproxy
template: src={{ base_dir }}/roles/lb/templates/haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
- name: 重启haproxy服务
shell: systemctl enable haproxy && systemctl restart haproxy
shell: systemctl restart haproxy
- hosts: new-master
roles:

View File

@ -26,8 +26,12 @@
- name: 创建docker的systemd unit文件
template: src=docker.service.j2 dest=/etc/systemd/system/docker.service
- name: 开机启用docker 服务
shell: systemctl enable docker
ignore_errors: true
- name: 开启docker 服务
shell: systemctl daemon-reload && systemctl enable docker && systemctl restart docker
shell: systemctl daemon-reload && systemctl restart docker
## 可选 ------安装docker查询镜像 tag的小工具----
# 先要安装轻量JSON处理程序jq已在 prepare 节点安装

View File

@ -31,5 +31,9 @@
- name: 创建etcd的systemd unit文件
template: src=etcd.service.j2 dest=/etc/systemd/system/etcd.service
- name: 开机启用etcd服务
shell: systemctl enable etcd
ignore_errors: true
- name: 开启etcd服务
shell: systemctl daemon-reload && systemctl enable etcd && systemctl restart etcd
shell: systemctl daemon-reload && systemctl restart etcd

View File

@ -40,6 +40,7 @@
- name: enable master 服务
shell: systemctl enable kube-apiserver kube-controller-manager kube-scheduler
ignore_errors: true
- name: 启动 master 服务
shell: "systemctl daemon-reload && systemctl restart kube-apiserver && \

View File

@ -39,8 +39,12 @@
template: src=kubelet.service.j2 dest=/etc/systemd/system/kubelet.service
tags: kubelet
- name: 开机启用kubelet 服务
shell: systemctl enable kubelet
ignore_errors: true
- name: 开启kubelet 服务
shell: systemctl daemon-reload && systemctl enable kubelet && systemctl restart kubelet
shell: systemctl daemon-reload && systemctl restart kubelet
tags: kubelet
##-------kube-proxy部分----------------
@ -51,9 +55,13 @@
tags: reload-kube-proxy
template: src=kube-proxy.service.j2 dest=/etc/systemd/system/kube-proxy.service
- name: 开机启用kube-proxy 服务
shell: systemctl enable kube-proxy
ignore_errors: true
- name: 开启kube-proxy 服务
tags: reload-kube-proxy
shell: systemctl daemon-reload && systemctl enable kube-proxy && systemctl restart kube-proxy
shell: systemctl daemon-reload && systemctl restart kube-proxy
# 批准 node 节点首先轮询等待kubelet启动完成
- name: 轮询等待kubelet启动

View File

@ -46,8 +46,16 @@
- name: daemon-reload for haproxy.service
shell: systemctl daemon-reload
- name: 开机启用haproxy服务
shell: systemctl enable haproxy
ignore_errors: true
- name: 重启haproxy服务
shell: systemctl enable haproxy && systemctl restart haproxy
shell: systemctl restart haproxy
- name: 开机启用keepalived服务
shell: systemctl enable keepalived
ignore_errors: true
- name: 重启keepalived服务
shell: systemctl enable keepalived && systemctl restart keepalived
shell: systemctl restart keepalived