
So that the docker mirror configuration can be used without the install-docker role (e.g., if another process is used to install docker on a target host), split the part of the role which configures mirrors into its own role and include it in the install-docker role. Change-Id: I7cd7f61e2d1281cd2949c1f69a081c7217d0d328
50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
- name: Set up docker mirrors
|
|
include_role:
|
|
name: use-docker-mirror
|
|
|
|
- name: Install docker-ce from upstream
|
|
include: upstream.yaml
|
|
when: use_upstream_docker
|
|
|
|
- name: Install docker from distro
|
|
include_tasks: "{{ lookup('first_found', params) }}"
|
|
vars:
|
|
params:
|
|
files:
|
|
- "{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
|
|
- "{{ ansible_distribution }}.yaml"
|
|
- "{{ ansible_os_family }}.yaml"
|
|
- "default.yaml"
|
|
paths:
|
|
- distros
|
|
when: not use_upstream_docker
|
|
|
|
- name: Add user to docker group
|
|
become: yes
|
|
user:
|
|
name: "{{ ansible_user }}"
|
|
groups:
|
|
- "{{ docker_group }}"
|
|
append: yes
|
|
|
|
- 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
|