-
Notifications
You must be signed in to change notification settings - Fork 3
/
verify-docker.yaml
46 lines (36 loc) · 1.63 KB
/
verify-docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
# Verifies that docker is installed and up to date
#
- name: Verify docker installed and up to date
hosts: docker-ready
sudo: yes
tasks:
- debug: msg="Supported docker version= {{docker.version}}"
- name: docker repo exists (CentOS 7)
shell: yum repolist -v
register: docker_repo_exists_centos
when: ansible_distribution == "CentOS" and
ansible_distribution_major_version == "7" and
docker.version == "1.7.0"
- fail: msg="Docker repo must be installed (CentOS 7)"
when: ansible_distribution == "CentOS" and
ansible_distribution_major_version == "7" and
docker.version == "1.7.1" and
docker_repo_exists_centos is defined and
docker_repo_exists_centos.stdout.find('docker-main-repo') == -1
# TODO: Check for docker group
# TODO: Verify that iplant user belongs to docker group
- name: docker version
shell: docker version --format=\{\{\.Client\.Version\}\}
register: docker_version
- debug: var=docker_version
when: "docker_version.stdout.find('{{docker.version}}') == -1"
- fail: msg="docker version is not {{docker.version}}"
when: "docker_version.stdout.find('{{docker.version}}') == -1"
- name: docker service exists
shell: systemctl status docker.service
register: verify_docker_service
when: ansible_distribution == "CentOS" and
ansible_distribution_major_version == "7"
- fail: msg="docker.service does not exist"
when: verify_docker_service.rc != 0