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: |
Zack Williams | 7d6747d | 2016-06-20 10:38:59 -0700 | [diff] [blame] | 24 | data="{{ lookup('file', 'docker_apt_key.gpg') }}" |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 25 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 26 | - name: Add docker apt repo |
| 27 | apt_repository: |
David K. Bainbridge | 77a516a | 2016-10-27 10:57:57 -0700 | [diff] [blame] | 28 | repo: "{{ docker_apt_repo | default('deb https://apt.dockerproject.org/repo ubuntu-trusty main') }}" |
Zack Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 29 | |
Zack Williams | 9e74c4a | 2016-05-21 10:00:03 -0700 | [diff] [blame] | 30 | - name: Install docker |
| 31 | apt: |
| 32 | update_cache=yes |
| 33 | cache_valid_time=3600 |
| 34 | name=docker-engine |
| 35 | |
Zack Williams | b31027a | 2016-05-23 07:40:06 -0700 | [diff] [blame] | 36 | - 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 Williams | e4fbacc | 2016-05-21 07:18:43 -0700 | [diff] [blame] | 42 | |
Zack Williams | b31027a | 2016-05-23 07:40:06 -0700 | [diff] [blame] | 43 | # 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 Williams | 1a10571 | 2016-05-22 07:38:39 -0700 | [diff] [blame] | 48 | |
| 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 | |