| --- |
| # Installs docker with apt, docker-compose with pip, adds user to group |
| # Must be run as root |
| |
| - hosts: docker |
| remote_user: ubuntu |
| become: yes |
| |
| tasks: |
| |
| # https://docs.docker.com/engine/installation/linux/ubuntulinux/ |
| - name: Prereqs and SSL support for apt for SSL |
| apt: |
| name={{ item }} |
| update_cache=yes |
| cache_valid_time=3600 |
| with_items: |
| - apt-transport-https |
| - ca-certificates |
| - python-pip |
| |
| - name: Trust docker apt key |
| apt_key: |
| data="{{ lookup('file', 'docker_apt_key.gpg') }}" |
| |
| - name: Add docker apt repo |
| apt_repository: |
| repo: "{{ docker_apt_repo | default('deb https://apt.dockerproject.org/repo ubuntu-trusty main') }}" |
| |
| - name: Install docker |
| apt: |
| update_cache=yes |
| cache_valid_time=3600 |
| name=docker-engine |
| |
| - name: Install docker-compose from web |
| get_url: |
| url=https://github.com/docker/compose/releases/download/1.7.1/docker-compose-Linux-x86_64 |
| checksum=sha256:3166bb74bc648e68c3154bc704fddf6bccf59f03a0c90fc48aefac034535e4ae |
| dest=/usr/local/bin/docker-compose |
| owner=root mode=0755 |
| |
| # This installs a bunch of prereqs that currently breaks SSL and CA's |
| # https://docs.docker.com/compose/install/#install-using-pip |
| #- name: Install docker-compose from PyPi |
| # pip: |
| # name=docker-compose |
| |
| - name: Make ubuntu user part of the Docker group |
| user: |
| name="ubuntu" |
| groups="docker" |
| append=yes |
| |
| - name: restart Docker daemon to get new group membership |
| service: |
| name=docker |
| state=restarted |
| |