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 10 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 @@
use_upstream_docker: True
docker_group: docker
docker_update_channel: stable
ubuntu_gpg_key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----

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

@@ -32,8 +32,26 @@
user:
name: "{{ ansible_user }}"
groups:
- docker
- "{{ docker_group }}"
append: yes

- name: reset ssh connection to pick up docker group
- name: Assure docker service is running
become: yes
service:
name: docker
enabled: yes
state: started

- name: Correct group ownership on docker sock
become: yes
file:
path: /var/run/docker.sock
group: "{{ docker_group }}"

- name: Reset ssh connection to pick up docker group
meta: reset_connection

- name: Validate ability to talk with docker
command: docker ps
args:
warn: no

Loading…
Cancel
Save