blob: 54812f0d6bed3f9713d8e23611219cfaa0311dcb [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040014- name: Debian add Docker repository and update apt cache
15 apt_repository:
16 repo: deb https://apt.dockerproject.org/repo ubuntu-{{ debian_version }} main
17 update_cache: yes
18 state: present
19 when: target == "installer"
20 tags: [docker]
Sergio Slobodrianee4b2bc2017-06-05 10:08:59 -040021
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040022- name: Debian Docker is present
23 apt:
24 name: docker-engine
25 state: latest
26 force: yes
27 when: target == "installer"
28 tags: [docker]
29
30- name: Debian python-pip is present
31 apt:
32 name: python-pip
33 state: present
34 when: target == "installer"
35 tags: [docker]
36
37- name: Debian docker-py is present
38 pip:
39 name: docker-py
40 version: "{{ docker_py_version }}"
41 state: present
42 when: target == "installer"
43 tags: [docker]
44
45- name: netifaces pip package is present
46 pip:
47 name: netifaces
48 version: "{{ netifaces_version }}"
49 state: present
50 when: target == "installer"
51 tags: [docker]
52
53- name: Docker config files are present
54 template:
55 src: "{{ docker_cfg }}"
56 dest: "{{ docker_cfg_dest }}"
57 register: copy_result
58 tags: [docker]
59
60- name: Debian Daemon is reloaded
61 command: systemctl daemon-reload
62 when: copy_result|changed and is_systemd is defined
63 tags: [docker]
64
65- name: Sudo user is added to the docker group
66 user:
67 name: "{{ ansible_env['SUDO_USER'] }}"
68 group: docker
69 register: user_result
70 tags: [docker]
71
72- name: Debian Docker service is restarted
73 service:
74 name: docker
75 state: restarted
76 when: copy_result|changed or user_result|changed
77 tags: [docker]