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
This commit is contained in:
Sorin Sbarnea 2019-01-30 13:53:46 +00:00
parent a9ae9ffb0c
commit 58cf603ce7
2 changed files with 21 additions and 2 deletions

View File

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

View File

@ -32,8 +32,26 @@
user: user:
name: "{{ ansible_user }}" name: "{{ ansible_user }}"
groups: groups:
- docker - "{{ docker_group }}"
append: yes 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 meta: reset_connection
- name: Validate ability to talk with docker
command: docker ps
args:
warn: no