Skip to content

Commit

Permalink
lineinfile替换shell sed
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed May 4, 2018
1 parent 550c8f2 commit b7a7eef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
10 changes: 7 additions & 3 deletions 11.harbor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- hosts:
- kube-master
- new-master
- kube-node
- new-node
tasks:
Expand All @@ -15,7 +16,10 @@
- name: harbor服务器证书安装
copy: src={{ ca_dir }}/ca.pem dest=/etc/docker/certs.d/{{ HARBOR_DOMAIN }}/ca.crt

# 如果你的环境中有dns服务器,可以跳过hosts文件设置
# 如果你的环境中有dns服务器,可以跳过hosts文件设置
- name: 增加harbor的hosts解析
shell: "sed -i '/{{ HARBOR_DOMAIN }}/d' /etc/hosts && \
echo {{ HARBOR_IP }} {{ HARBOR_DOMAIN }} >> /etc/hosts"
lineinfile:
dest: /etc/hosts
state: present
regexp: '{{ HARBOR_DOMAIN }}'
line: '{{ HARBOR_IP }} {{ HARBOR_DOMAIN }}'
14 changes: 7 additions & 7 deletions 99.clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@
- "/root/.kube/"
- "/etc/docker/"

- hosts:
- kube-master
- kube-node
- deploy
- etcd
- lb
tasks:
- name: 清理自动生成的PATH
lineinfile:
dest: /etc/profile
state: absent
regexp: 'kubeasz'

- name: 清理 kubectl 命令自动补全
lineinfile:
dest: /etc/profile
state: absent
regexp: 'kubectl completion'

4 changes: 2 additions & 2 deletions down/download.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
#主要组件版本如下
export K8S_VER=v1.9.6
export ETCD_VER=v3.3.2
export K8S_VER=v1.10.2
export ETCD_VER=v3.3.4
export DOCKER_VER=18.03.0-ce
export CNI_VER=v0.7.0
export DOCKER_COMPOSE=1.18.0
Expand Down
8 changes: 6 additions & 2 deletions roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- name: 写入环境变量$PATH
lineinfile:
dest: /etc/profile
state: present
regexp: 'kubeasz'
line: 'export PATH={{ bin_dir }}:$PATH # generated by kubeasz'

Expand Down Expand Up @@ -84,8 +85,11 @@
when: ansible_distribution == "CentOS"

- name: 添加 kubectl 命令自动补全
shell: "sed -i '/kubectl completion/d' ~/.bashrc && \
echo 'source <(kubectl completion bash)' >> ~/.bashrc"
lineinfile:
dest: /etc/profile
state: present
regexp: 'kubectl completion'
line: 'source <(kubectl completion bash)'

# 设置系统参数for k8s
# 消除docker info 警告WARNING: bridge-nf-call-ip[6]tables is disabled
Expand Down

0 comments on commit b7a7eef

Please sign in to comment.