Browse Source

Make install-docker compatible with centos

Allow custom docker_group which is needed on CentOS when
use_upstream_docker: false as is value is 'dockeroot'.

Assures that docker service is started, which is not always true
with all distributions.

Validates that we can talk with docker at the end.

Change-Id: I993c4ac35055a2a18b5b0fb32c8b230e04b7eb87
changes/48/633948/13
Sorin Sbarnea 5 months ago
parent
commit
58cf603ce7
2 changed files with 21 additions and 2 deletions
  1. 1
    0
      roles/install-docker/defaults/main.yaml
  2. 20
    2
      roles/install-docker/tasks/main.yaml

+ 1
- 0
roles/install-docker/defaults/main.yaml View File

@@ -1,4 +1,5 @@
1 1
 use_upstream_docker: True
2
+docker_group: docker
2 3
 docker_update_channel: stable
3 4
 ubuntu_gpg_key: |
4 5
   -----BEGIN PGP PUBLIC KEY BLOCK-----

+ 20
- 2
roles/install-docker/tasks/main.yaml View File

@@ -32,8 +32,26 @@
32 32
   user:
33 33
     name: "{{ ansible_user }}"
34 34
     groups:
35
-      - docker
35
+      - "{{ docker_group }}"
36 36
     append: yes
37 37
 
38
-- name: reset ssh connection to pick up docker group
38
+- name: Assure docker service is running
39
+  become: yes
40
+  service:
41
+    name: docker
42
+    enabled: yes
43
+    state: started
44
+
45
+- name: Correct group ownership on docker sock
46
+  become: yes
47
+  file:
48
+    path: /var/run/docker.sock
49
+    group: "{{ docker_group }}"
50
+
51
+- name: Reset ssh connection to pick up docker group
39 52
   meta: reset_connection
53
+
54
+- name: Validate ability to talk with docker
55
+  command: docker ps
56
+  args:
57
+    warn: no

Loading…
Cancel
Save