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: |
Zack Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 8 | name: "{{ item }}" |
| 9 | update_cache: yes |
| 10 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 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: |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 29 | name: "docker-ce=17.06.*" |
Zack Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 30 | update_cache: yes |
| 31 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 32 | |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 33 | - name: Remove obsolete docker-py pip module |
| 34 | become: yes |
| 35 | pip: |
| 36 | name: docker-py |
| 37 | state: absent |
| 38 | |
| 39 | - name: Install pip modules for docker and docker-compose |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 40 | become: yes |
| 41 | pip: |
| 42 | name: "{{ item }}" |
| 43 | with_items: |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 44 | - docker>=2.4.2 |
| 45 | - docker-compose>=1.14.0 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 46 | |
| 47 | - name: Make current user part of the Docker group |
| 48 | become: yes |
| 49 | user: |
| 50 | name: "{{ ansible_user_id }}" |
| 51 | groups: "docker" |
| 52 | append: yes |
| 53 | |