Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 1 | --- |
| 2 | |
| 3 | - name: Prereqs and SSL support for apt for SSL |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 4 | become: yes |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 5 | apt: |
| 6 | name: "{{ item }}" |
| 7 | update_cache: yes |
| 8 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 9 | with_items: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 10 | - apt-transport-https |
| 11 | - ca-certificates |
| 12 | - python-pip |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 13 | |
| 14 | - name: Docker Apt Key |
| 15 | become: yes |
| 16 | apt_key: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 17 | data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 18 | |
| 19 | - name: Docker repository |
| 20 | become: yes |
| 21 | apt_repository: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 22 | repo: "{{ docker_apt_repo }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 23 | |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 24 | - name: Install docker-ce |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 25 | become: yes |
| 26 | apt: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 27 | name: "docker-ce=17.06.*" |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 28 | update_cache: yes |
| 29 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 30 | |
David K. Bainbridge | f62e70d | 2016-06-13 17:23:01 -0700 | [diff] [blame] | 31 | - name: Docker Exposed via TCP |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 32 | become: yes |
| 33 | lineinfile: |
| 34 | dest=/etc/default/docker |
| 35 | state=present |
| 36 | insertafter='#DOCKER_OPTS' |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 37 | line='DOCKER_OPTS="-H unix:///var/run/docker.sock"' |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 38 | register: docker_config |
| 39 | |
| 40 | - name: Docker Restart |
| 41 | become: yes |
| 42 | service: |
| 43 | name=docker |
| 44 | state=restarted |
| 45 | when: docker_config.changed |
| 46 | |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 47 | # docker fails without docker-py, docker-compose >1.9 fails with docker-py installed |
| 48 | - name: Install docker-compose and docker-py |
| 49 | become: yes |
| 50 | pip: |
| 51 | name: "{{ item }}" |
| 52 | with_items: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 53 | - "docker==2.4.2" |
| 54 | - "docker-compose==1.14.0" |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 55 | |
| 56 | - name: Make current user part of the Docker group |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 57 | become: yes |
| 58 | user: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 59 | name: "{{ ansible_user_id }}" |
| 60 | groups: "docker" |
| 61 | append: yes |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 62 | |