blob: 074ac8272f3d5da980fc7165921622cc22d5abb0 [file] [log] [blame]
Jonathan Hart93956f52017-08-22 13:12:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Zack Williams642388d2017-04-12 22:39:15 -070017---
18
19- name: Prereqs and SSL support for apt for SSL
David K. Bainbridge317e7d72016-05-11 08:31:44 -070020 become: yes
Zack Williams642388d2017-04-12 22:39:15 -070021 apt:
22 name: "{{ item }}"
23 update_cache: yes
24 cache_valid_time: 3600
David K. Bainbridge317e7d72016-05-11 08:31:44 -070025 with_items:
Zack Williams642388d2017-04-12 22:39:15 -070026 - apt-transport-https
27 - ca-certificates
28 - python-pip
David K. Bainbridge317e7d72016-05-11 08:31:44 -070029
30- name: Docker Apt Key
31 become: yes
32 apt_key:
Zack Williams642388d2017-04-12 22:39:15 -070033 data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070034
35- name: Docker repository
36 become: yes
37 apt_repository:
Zack Williams642388d2017-04-12 22:39:15 -070038 repo: "{{ docker_apt_repo }}"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070039
Zack Williams6fe46372017-06-29 08:30:21 -070040- name: Install docker-ce
David K. Bainbridge317e7d72016-05-11 08:31:44 -070041 become: yes
42 apt:
Zack Williams6fe46372017-06-29 08:30:21 -070043 name: "docker-ce=17.06.*"
Zack Williams642388d2017-04-12 22:39:15 -070044 update_cache: yes
45 cache_valid_time: 3600
David K. Bainbridge317e7d72016-05-11 08:31:44 -070046
David K. Bainbridgef62e70d2016-06-13 17:23:01 -070047- name: Docker Exposed via TCP
David K. Bainbridge2a804222016-05-16 12:36:32 -070048 become: yes
49 lineinfile:
50 dest=/etc/default/docker
51 state=present
52 insertafter='#DOCKER_OPTS'
David K. Bainbridge8b179042016-11-30 15:38:42 -080053 line='DOCKER_OPTS="-H unix:///var/run/docker.sock"'
David K. Bainbridge2a804222016-05-16 12:36:32 -070054 register: docker_config
55
56- name: Docker Restart
57 become: yes
58 service:
59 name=docker
60 state=restarted
61 when: docker_config.changed
62
Zack Williams642388d2017-04-12 22:39:15 -070063# docker fails without docker-py, docker-compose >1.9 fails with docker-py installed
64- name: Install docker-compose and docker-py
65 become: yes
66 pip:
67 name: "{{ item }}"
68 with_items:
Zack Williams6fe46372017-06-29 08:30:21 -070069 - "docker==2.4.2"
70 - "docker-compose==1.14.0"
Zack Williams642388d2017-04-12 22:39:15 -070071
72- name: Make current user part of the Docker group
David K. Bainbridge2a804222016-05-16 12:36:32 -070073 become: yes
74 user:
Zack Williams642388d2017-04-12 22:39:15 -070075 name: "{{ ansible_user_id }}"
76 groups: "docker"
77 append: yes
David K. Bainbridge2a804222016-05-16 12:36:32 -070078