blob: ee8b9ea71486285d4cfef2ddd3c108b7cab338b5 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31: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 Williamsa2763112017-01-03 11:38:38 -070017---
18# docker-install/tasks/main.yml
19# note - all tasks run with become to preserve the `ansible_user_id` var
20
21- name: Prereqs and SSL support for apt for SSL
22 become: yes
23 apt:
Zack Williams1396aa32017-06-06 10:28:29 -070024 name: "{{ item }}"
25 update_cache: yes
26 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070027 with_items:
28 - apt-transport-https
29 - ca-certificates
30 - python-pip
31
32- name: Trust docker apt key
33 become: yes
34 apt_key:
35 data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
36
37- name: Add docker apt repo
38 become: yes
39 apt_repository:
40 repo: "{{ docker_apt_repo }}"
41
42- name: Install docker
43 become: yes
44 apt:
Zack Williams0ab8f512017-06-29 08:41:51 -070045 name: "docker-ce=17.06.*"
Zack Williams1396aa32017-06-06 10:28:29 -070046 update_cache: yes
47 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070048
Andy Bavier0272aa52017-08-16 15:40:06 -070049- name: Configure Docker
50 become: yes
51 template:
52 src=default_docker.j2
53 dest=/etc/default/docker
54 mode=0644
55 owner=root
56 group=root
57 notify: restart docker
58
Zack Williamsbf43d752017-07-01 15:27:11 -070059- name: Install docker-compose, docker python module, imagebuilder deps via pip
Zack Williamsa2763112017-01-03 11:38:38 -070060 become: yes
61 pip:
62 name: "{{ item }}"
63 with_items:
Zack Williams0ab8f512017-06-29 08:41:51 -070064 - docker>=2.4.2
65 - docker-compose>=1.14.0
Zack Williamsbf43d752017-07-01 15:27:11 -070066 - gitpython
67 - graphviz
Zack Williamsa2763112017-01-03 11:38:38 -070068
69- name: Make current user part of the Docker group
70 become: yes
71 user:
72 name: "{{ ansible_user_id }}"
73 groups: "docker"
74 append: yes
75
Zack Williamsbf43d752017-07-01 15:27:11 -070076# Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794
77# see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings
78- name: Reset ssh connection so user gains docker group membership
79 meta: reset_connection
80