Jonathan Hart | 93956f5 | 2017-08-22 13:12:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 17 | --- |
| 18 | |
| 19 | - name: Prereqs and SSL support for apt for SSL |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 20 | become: yes |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 21 | apt: |
| 22 | name: "{{ item }}" |
| 23 | update_cache: yes |
| 24 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 25 | with_items: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 26 | - apt-transport-https |
| 27 | - ca-certificates |
| 28 | - python-pip |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 29 | |
| 30 | - name: Docker Apt Key |
| 31 | become: yes |
| 32 | apt_key: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 33 | data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 34 | |
| 35 | - name: Docker repository |
| 36 | become: yes |
| 37 | apt_repository: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 38 | repo: "{{ docker_apt_repo }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 39 | |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 40 | - name: Install docker-ce |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 41 | become: yes |
| 42 | apt: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 43 | name: "docker-ce=17.06.*" |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 44 | update_cache: yes |
| 45 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 46 | |
David K. Bainbridge | f62e70d | 2016-06-13 17:23:01 -0700 | [diff] [blame] | 47 | - name: Docker Exposed via TCP |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 48 | become: yes |
| 49 | lineinfile: |
| 50 | dest=/etc/default/docker |
| 51 | state=present |
| 52 | insertafter='#DOCKER_OPTS' |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 53 | line='DOCKER_OPTS="-H unix:///var/run/docker.sock"' |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 54 | register: docker_config |
| 55 | |
| 56 | - name: Docker Restart |
| 57 | become: yes |
| 58 | service: |
| 59 | name=docker |
| 60 | state=restarted |
| 61 | when: docker_config.changed |
| 62 | |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 63 | # docker fails without docker-py, docker-compose >1.9 fails with docker-py installed |
| 64 | - name: Install docker-compose and docker-py |
| 65 | become: yes |
| 66 | pip: |
| 67 | name: "{{ item }}" |
| 68 | with_items: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 69 | - "docker==2.4.2" |
| 70 | - "docker-compose==1.14.0" |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 71 | |
| 72 | - name: Make current user part of the Docker group |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 73 | become: yes |
| 74 | user: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame] | 75 | name: "{{ ansible_user_id }}" |
| 76 | groups: "docker" |
| 77 | append: yes |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 78 | |