diff --git a/roles/install-docker/defaults/main.yaml b/roles/install-docker/defaults/main.yaml index 635168018..bef4fbdef 100644 --- a/roles/install-docker/defaults/main.yaml +++ b/roles/install-docker/defaults/main.yaml @@ -1,4 +1,5 @@ use_upstream_docker: True +docker_group: docker docker_update_channel: stable ubuntu_gpg_key: | -----BEGIN PGP PUBLIC KEY BLOCK----- diff --git a/roles/install-docker/tasks/main.yaml b/roles/install-docker/tasks/main.yaml index 875d7603b..d0da85bac 100644 --- a/roles/install-docker/tasks/main.yaml +++ b/roles/install-docker/tasks/main.yaml @@ -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