| --- |
| |
| - 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: Docker Apt Key |
| become: yes |
| apt_key: |
| data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
| |
| - name: Docker repository |
| become: yes |
| apt_repository: |
| repo: "{{ docker_apt_repo }}" |
| |
| - name: Install docker engine |
| become: yes |
| apt: |
| name: docker-engine=1.12* |
| force: yes |
| update_cache: yes |
| cache_valid_time: 3600 |
| |
| - name: Docker Exposed via TCP |
| become: yes |
| lineinfile: |
| dest=/etc/default/docker |
| state=present |
| insertafter='#DOCKER_OPTS' |
| line='DOCKER_OPTS="-H unix:///var/run/docker.sock"' |
| register: docker_config |
| |
| - name: Docker Restart |
| become: yes |
| service: |
| name=docker |
| state=restarted |
| when: docker_config.changed |
| |
| # docker fails without docker-py, docker-compose >1.9 fails with docker-py installed |
| - name: Install docker-compose and docker-py |
| become: yes |
| pip: |
| name: "{{ item }}" |
| with_items: |
| - docker-py |
| - docker-compose==1.9 |
| |
| - name: Make current user part of the Docker group |
| become: yes |
| user: |
| name: "{{ ansible_user_id }}" |
| groups: "docker" |
| append: yes |
| |