Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 1 | --- |
| 2 | # docker-install/tasks/main.yml |
| 3 | # note - all tasks run with become to preserve the `ansible_user_id` var |
| 4 | |
| 5 | - name: Prereqs and SSL support for apt for SSL |
| 6 | become: yes |
| 7 | apt: |
| 8 | name={{ item }} |
| 9 | update_cache=yes |
| 10 | cache_valid_time=3600 |
| 11 | with_items: |
| 12 | - apt-transport-https |
| 13 | - ca-certificates |
| 14 | - python-pip |
| 15 | |
| 16 | - name: Trust docker apt key |
| 17 | become: yes |
| 18 | apt_key: |
| 19 | data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
| 20 | |
| 21 | - name: Add docker apt repo |
| 22 | become: yes |
| 23 | apt_repository: |
| 24 | repo: "{{ docker_apt_repo }}" |
| 25 | |
| 26 | - name: Install docker |
| 27 | become: yes |
| 28 | apt: |
| 29 | update_cache=yes |
| 30 | cache_valid_time=3600 |
| 31 | name=docker-engine |
| 32 | |
| 33 | # docker fails without docker-py, docker-compose >1.9 fails with docker-py installed |
| 34 | - name: Install docker-compose and docker-py |
| 35 | become: yes |
| 36 | pip: |
| 37 | name: "{{ item }}" |
| 38 | with_items: |
| 39 | - docker-py |
| 40 | - docker-compose==1.9 |
| 41 | |
| 42 | - name: Make current user part of the Docker group |
| 43 | become: yes |
| 44 | user: |
| 45 | name: "{{ ansible_user_id }}" |
| 46 | groups: "docker" |
| 47 | append: yes |
| 48 | |