fix2: docker/containerd是否需要安装的判断条件

pull/1076/head
gjmzj 2021-09-25 00:59:51 +08:00
parent b3dca0100e
commit ad7f1082f7
3 changed files with 10 additions and 10 deletions

View File

@ -1,11 +1,11 @@
- name: 获取是否已经安装docker
shell: 'systemctl is-active docker || echo "NOT FOUND"'
shell: 'systemctl is-active docker || echo "NoFound"'
register: docker_status
- name: WARNNING 提示
debug:
msg: "[WARN]: docker is running, and containerd will be installed"
when: '"active" in docker_status.stdout'
when: '"NoFound" not in docker_status.stdout'
- name: 获取是否已经安装containerd
shell: 'systemctl is-active containerd || echo "NoFound"'
@ -66,4 +66,4 @@
state: present
regexp: 'crictl completion'
line: 'source <(crictl completion)'
when: "'active' not in containerd_svc.stdout"
when: "'NoFound' in containerd_svc.stdout"

View File

@ -113,7 +113,7 @@
- name: 配置 docker 命令软链接
file: src={{ bin_dir }}/docker dest=/usr/bin/docker state=link
ignore_errors: true
when: "'active' not in containerd_svc.stdout and 'active' not in docker_svc.stdout"
when: "'NoFound' in containerd_svc.stdout and 'NoFound' in docker_svc.stdout"
## 可选 ------安装docker查询镜像 tag的小工具----
- name: 下载 docker-tag

View File

@ -1,10 +1,10 @@
# 系统基础软件环境
- name: apt更新缓存刷新
apt: update_cache=yes cache_valid_time=72000
ignore_errors: true
when:
- 'ansible_distribution in ["Ubuntu","Debian"]'
- 'INSTALL_SOURCE != "offline"'
#- name: apt更新缓存刷新
# apt: update_cache=yes cache_valid_time=72000
# ignore_errors: true
# when:
# - 'ansible_distribution in ["Ubuntu","Debian"]'
# - 'INSTALL_SOURCE != "offline"'
- import_tasks: ubuntu.yml
when: 'ansible_distribution in ["Ubuntu","Debian"]'