mirror of https://github.com/easzlab/kubeasz.git
minor fix: add cmd alias
parent
8209eb36e8
commit
abfadf011f
3
ezdown
3
ezdown
|
@ -436,6 +436,8 @@ function start_local_registry() {
|
|||
|
||||
function start_kubeasz_docker() {
|
||||
[[ -d "$BASE/roles/kube-node" ]] || { logger error "not initialized. try 'ezdown -D' first."; exit 1; }
|
||||
docker ps -a --format="{{ .Names }}"|grep kubeasz > /dev/null 2>&1 && \
|
||||
{ logger warn "kubeasz container is already existed"; return 0; }
|
||||
|
||||
logger info "try to run kubeasz in a container"
|
||||
# get host's IP
|
||||
|
@ -465,6 +467,7 @@ function start_kubeasz_docker() {
|
|||
--restart always \
|
||||
--volume "$BASE":"$BASE" \
|
||||
--volume /root/.kube:/root/.kube \
|
||||
--volume /root/.bashrc:/root/.bashrc \
|
||||
--volume /root/.ssh:/root/.ssh \
|
||||
--volume /etc/docker:/etc/docker \
|
||||
easzlab/kubeasz:${KUBEASZ_VER} sleep 36000
|
||||
|
|
|
@ -56,18 +56,20 @@
|
|||
file: src={{ base_dir }}/bin/kubectl dest=/usr/bin/kubectl state=link
|
||||
ignore_errors: true
|
||||
|
||||
# 注册变量以判断是否容器化运行ansible控制端,如果容器化运行那么进程数小于50
|
||||
- name: 注册变量以判断是否容器化运行ansible控制端
|
||||
shell: "ps aux|wc -l"
|
||||
register: procs
|
||||
|
||||
- name: ansible 控制端写入环境变量$PATH
|
||||
lineinfile:
|
||||
dest: ~/.bashrc
|
||||
state: present
|
||||
regexp: 'kubeasz'
|
||||
line: 'export PATH={{ base_dir }}/bin/:$PATH # generated by kubeasz'
|
||||
when: "procs.stdout|int > 50"
|
||||
regexp: 'custom PATH'
|
||||
line: 'export PATH={{ base_dir }}/bin/:$PATH # custom PATH generated by kubeasz'
|
||||
ignore_errors: true
|
||||
|
||||
- name: ansible 控制端写入命令别名
|
||||
lineinfile:
|
||||
dest: ~/.bashrc
|
||||
state: present
|
||||
regexp: 'docker exec'
|
||||
line: "alias dek='docker exec -it kubeasz' # custom PATH generated by kubeasz"
|
||||
ignore_errors: true
|
||||
|
||||
- name: ansible 控制端添加 kubectl 自动补全
|
||||
|
@ -75,6 +77,5 @@
|
|||
dest: ~/.bashrc
|
||||
state: present
|
||||
regexp: 'kubectl completion'
|
||||
line: 'source <(kubectl completion bash)'
|
||||
when: "procs.stdout|int > 50"
|
||||
line: 'source <(kubectl completion bash) # generated by kubeasz'
|
||||
ignore_errors: true
|
||||
|
|
Loading…
Reference in New Issue