Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Installs docker with apt, docker-compose with pip, adds user to group |
| 3 | # Must be run as root |
| 4 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 5 | - hosts: docker |
| 6 | remote_user: ubuntu |
| 7 | become: yes |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 8 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 9 | tasks: |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 10 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 11 | # 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 Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 21 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 22 | - name: Trust docker apt key |
| 23 | apt_key: |
| 24 | keyserver=pool.sks-keyservers.net |
| 25 | id=58118E89F3A912897C070ADBF76221572C52609D |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 26 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 27 | - name: Add docker apt repo |
| 28 | apt_repository: |
| 29 | repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 30 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 31 | - name: Install docker |
| 32 | apt: |
| 33 | update_cache=yes |
| 34 | cache_valid_time=3600 |
| 35 | name=docker-engine |
| 36 | |
Zack Williams | b31027a | 2016-05-23 07:40:06 -0700 | [diff] [blame] | 37 | - name: Install docker-compose from web |
| 38 | get_url: |
| 39 | url=https://github.com/docker/compose/releases/download/1.7.1/docker-compose-Linux-x86_64 |
| 40 | checksum=sha256:3166bb74bc648e68c3154bc704fddf6bccf59f03a0c90fc48aefac034535e4ae |
| 41 | dest=/usr/local/bin/docker-compose |
| 42 | owner=root mode=0755 |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 43 | |
Zack Williams | b31027a | 2016-05-23 07:40:06 -0700 | [diff] [blame] | 44 | # This installs a bunch of prereqs that currently breaks SSL and CA's |
| 45 | # https://docs.docker.com/compose/install/#install-using-pip |
| 46 | #- name: Install docker-compose from PyPi |
| 47 | # pip: |
| 48 | # name=docker-compose |
Zack Williams | 1a10571 | 2016-05-22 07:38:39 -0700 | [diff] [blame] | 49 | |
| 50 | - name: Make ubuntu user part of the Docker group |
| 51 | user: |
| 52 | name="ubuntu" |
| 53 | groups="docker" |
| 54 | append=yes |
| 55 | |
| 56 | - name: restart Docker daemon to get new group membership |
| 57 | service: |
| 58 | name=docker |
| 59 | state=restarted |
| 60 | |