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 | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 17 | --- |
| 18 | |
| 19 | - name: Trust docker apt key |
| 20 | apt_key: |
| 21 | data={{ lookup('file', 'docker_apt_key.gpg') }} |
| 22 | |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 23 | - name: Debian add Docker repository and update apt cache |
| 24 | apt_repository: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 25 | repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 26 | update_cache: yes |
| 27 | state: present |
| 28 | tags: [docker] |
| 29 | |
| 30 | - name: Debian Docker is present |
| 31 | apt: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 32 | name: "docker-ce=17.06.*" |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 33 | state: present |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 34 | force: yes |
| 35 | tags: [docker] |
| 36 | |
| 37 | - name: Debian python-pip is present |
| 38 | apt: name=python-pip state=present |
| 39 | tags: [docker] |
| 40 | |
| 41 | - name: Debian docker-py is present |
| 42 | pip: |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 43 | name: "docker==2.4.2" |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 44 | state: present |
| 45 | tags: [docker] |
| 46 | |
| 47 | - name: Debian files are present |
| 48 | template: |
| 49 | src: "{{ docker_cfg }}" |
| 50 | dest: "{{ docker_cfg_dest }}" |
| 51 | register: copy_result |
| 52 | tags: [docker] |
| 53 | |
| 54 | - name: Debian Daemon is reloaded |
| 55 | command: systemctl daemon-reload |
| 56 | when: copy_result|changed and is_systemd is defined |
| 57 | tags: [docker] |
| 58 | |
| 59 | - name: vagrant user is added to the docker group |
| 60 | user: |
| 61 | name: vagrant |
| 62 | group: docker |
| 63 | register: user_result |
| 64 | tags: [docker] |
| 65 | |
| 66 | - name: Debian Docker service is restarted |
| 67 | service: |
| 68 | name: docker |
| 69 | state: restarted |
| 70 | when: copy_result|changed or user_result|changed |
| 71 | tags: [docker] |
| 72 | |
| 73 | - name: DockerUI is running |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 74 | docker_container: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 75 | image: abh1nav/dockerui |
| 76 | name: dockerui |
| 77 | ports: 9000:9000 |
| 78 | privileged: yes |
| 79 | volumes: |
| 80 | - /var/run/docker.sock:/var/run/docker.sock |
| 81 | when: not skip_ui is defined |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 82 | tags: [docker] |