blob: 965b127879276351e783e0eb416887b843ae556b [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
Zack Williamsbf43d752017-07-01 15:27:11 -070049- name: Install docker-compose, docker python module, imagebuilder deps via pip
Zack Williamsa2763112017-01-03 11:38:38 -070050 become: yes
51 pip:
52 name: "{{ item }}"
53 with_items:
Zack Williams0ab8f512017-06-29 08:41:51 -070054 - docker>=2.4.2
55 - docker-compose>=1.14.0
Zack Williamsbf43d752017-07-01 15:27:11 -070056 - gitpython
57 - graphviz
Zack Williamsa2763112017-01-03 11:38:38 -070058
59- name: Make current user part of the Docker group
60 become: yes
61 user:
62 name: "{{ ansible_user_id }}"
63 groups: "docker"
64 append: yes
65
Zack Williamsbf43d752017-07-01 15:27:11 -070066# Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794
67# see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings
68- name: Reset ssh connection so user gains docker group membership
69 meta: reset_connection
70