blob: 613025a1c3e8e6159d864d6eabe274a1e56438c2 [file] [log] [blame]
Zack Williamse451cef2018-04-01 19:44:19 -07001---
Matteo Scandolo3896c472017-08-01 13:31:42 -07002# 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
Zack Williamsa2763112017-01-03 11:38:38 -070016# docker-install/tasks/main.yml
17# note - all tasks run with become to preserve the `ansible_user_id` var
18
19- name: Prereqs and SSL support for apt for SSL
20 become: yes
21 apt:
Zack Williams1396aa32017-06-06 10:28:29 -070022 name: "{{ item }}"
23 update_cache: yes
24 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070025 with_items:
26 - apt-transport-https
27 - ca-certificates
28 - python-pip
29
30- name: Trust docker apt key
31 become: yes
32 apt_key:
33 data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
34
35- name: Add docker apt repo
36 become: yes
37 apt_repository:
38 repo: "{{ docker_apt_repo }}"
39
40- name: Install docker
41 become: yes
42 apt:
Zack Williams0ab8f512017-06-29 08:41:51 -070043 name: "docker-ce=17.06.*"
Zack Williams1396aa32017-06-06 10:28:29 -070044 update_cache: yes
45 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070046
Andy Bavier0272aa52017-08-16 15:40:06 -070047- name: Configure Docker
48 become: yes
49 template:
50 src=default_docker.j2
51 dest=/etc/default/docker
52 mode=0644
53 owner=root
54 group=root
55 notify: restart docker
56
Zack Williamsbf43d752017-07-01 15:27:11 -070057- name: Install docker-compose, docker python module, imagebuilder deps via pip
Zack Williamsa2763112017-01-03 11:38:38 -070058 become: yes
59 pip:
60 name: "{{ item }}"
61 with_items:
Zack Williamse451cef2018-04-01 19:44:19 -070062 - docker==3.2.1
63 - docker-compose==1.20.1
Zack Williamsbf43d752017-07-01 15:27:11 -070064 - gitpython
65 - graphviz
Zack Williamsa2763112017-01-03 11:38:38 -070066
67- name: Make current user part of the Docker group
68 become: yes
69 user:
70 name: "{{ ansible_user_id }}"
71 groups: "docker"
72 append: yes
73
Zack Williamsbf43d752017-07-01 15:27:11 -070074# Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794
75# see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings
Zack Williams09765832017-09-19 17:26:09 -070076# FIXME (zdw, 2017-09-19): busted in 2.4, per https://groups.google.com/forum/#!msg/ansible-project/vk7i2DszfZg/myI1uCroAQAJ
77#- name: Reset ssh connection so user gains docker group membership
78# meta: reset_connection
Zack Williamsbf43d752017-07-01 15:27:11 -070079