blob: 484f196d3423eab9a6a5d4fede69345f3eaccfe1 [file] [log] [blame]
Zack Williamse4fbacc2016-05-21 07:18:43 -07001---
2# Installs docker with apt, docker-compose with pip, adds user to group
3# Must be run as root
4
Zack Williams9e74c4a2016-05-21 10:00:03 -07005- hosts: docker
6 remote_user: ubuntu
7 become: yes
Zack Williamse4fbacc2016-05-21 07:18:43 -07008
Zack Williams9e74c4a2016-05-21 10:00:03 -07009 tasks:
Zack Williamse4fbacc2016-05-21 07:18:43 -070010
Zack Williams9e74c4a2016-05-21 10:00:03 -070011 # https://docs.docker.com/engine/installation/linux/ubuntulinux/
12 - name: Prereqs and SSL support for apt for SSL
13 apt:
14 name={{ item }}
15 update_cache=yes
16 cache_valid_time=3600
17 with_items:
18 - apt-transport-https
19 - ca-certificates
20 - python-pip
Zack Williamse4fbacc2016-05-21 07:18:43 -070021
Zack Williams9e74c4a2016-05-21 10:00:03 -070022 - name: Trust docker apt key
23 apt_key:
Zack Williams7d6747d2016-06-20 10:38:59 -070024 data="{{ lookup('file', 'docker_apt_key.gpg') }}"
Zack Williamse4fbacc2016-05-21 07:18:43 -070025
Zack Williams9e74c4a2016-05-21 10:00:03 -070026 - name: Add docker apt repo
27 apt_repository:
David K. Bainbridge77a516a2016-10-27 10:57:57 -070028 repo: "{{ docker_apt_repo | default('deb https://apt.dockerproject.org/repo ubuntu-trusty main') }}"
Zack Williamse4fbacc2016-05-21 07:18:43 -070029
Zack Williams9e74c4a2016-05-21 10:00:03 -070030 - name: Install docker
31 apt:
32 update_cache=yes
33 cache_valid_time=3600
34 name=docker-engine
35
Zack Williamsb31027a2016-05-23 07:40:06 -070036 - name: Install docker-compose from web
37 get_url:
38 url=https://github.com/docker/compose/releases/download/1.7.1/docker-compose-Linux-x86_64
39 checksum=sha256:3166bb74bc648e68c3154bc704fddf6bccf59f03a0c90fc48aefac034535e4ae
40 dest=/usr/local/bin/docker-compose
41 owner=root mode=0755
Zack Williamse4fbacc2016-05-21 07:18:43 -070042
Zack Williamsb31027a2016-05-23 07:40:06 -070043 # This installs a bunch of prereqs that currently breaks SSL and CA's
44 # https://docs.docker.com/compose/install/#install-using-pip
45 #- name: Install docker-compose from PyPi
46 # pip:
47 # name=docker-compose
Zack Williams1a105712016-05-22 07:38:39 -070048
49 - name: Make ubuntu user part of the Docker group
50 user:
51 name="ubuntu"
52 groups="docker"
53 append=yes
54
55 - name: restart Docker daemon to get new group membership
56 service:
57 name=docker
58 state=restarted
59