blob: b758d3e42266e2d9dce45a17f80e5b8301928ac2 [file] [log] [blame]
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# docker-install/tasks/main.yml
# note - all tasks run with become to preserve the `ansible_user_id` var
- name: Prereqs and SSL support for apt for SSL
become: yes
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
with_items:
- apt-transport-https
- ca-certificates
- python-pip
- name: Trust docker apt key
become: yes
apt_key:
data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
- name: Add docker apt repo
become: yes
apt_repository:
repo: "{{ docker_apt_repo }}"
- name: Install docker
become: yes
apt:
name: "docker-ce=17.06.*"
update_cache: yes
cache_valid_time: 3600
- name: Configure Docker
become: yes
template:
src=default_docker.j2
dest=/etc/default/docker
mode=0644
owner=root
group=root
notify: restart docker
- name: Install docker-compose, docker python module, imagebuilder deps via pip
become: yes
pip:
name: "{{ item }}"
with_items:
- docker>=2.4.2
- docker-compose==1.15.0
- gitpython
- graphviz
- name: Make current user part of the Docker group
become: yes
user:
name: "{{ ansible_user_id }}"
groups: "docker"
append: yes
# Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794
# see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings
# FIXME (zdw, 2017-09-19): busted in 2.4, per https://groups.google.com/forum/#!msg/ansible-project/vk7i2DszfZg/myI1uCroAQAJ
#- name: Reset ssh connection so user gains docker group membership
# meta: reset_connection