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 |
Zack Williams | e2fc42a | 2018-01-31 18:38:58 -0700 | [diff] [blame] | 55 | systemd: |
| 56 | daemon_reload: yes |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 57 | when: copy_result|changed and is_systemd is defined |
| 58 | tags: [docker] |
| 59 | |
| 60 | - name: vagrant user is added to the docker group |
| 61 | user: |
| 62 | name: vagrant |
| 63 | group: docker |
| 64 | register: user_result |
| 65 | tags: [docker] |
| 66 | |
| 67 | - name: Debian Docker service is restarted |
| 68 | service: |
| 69 | name: docker |
| 70 | state: restarted |
| 71 | when: copy_result|changed or user_result|changed |
| 72 | tags: [docker] |
| 73 | |
| 74 | - name: DockerUI is running |
Zack Williams | 6fe4637 | 2017-06-29 08:30:21 -0700 | [diff] [blame] | 75 | docker_container: |
David K. Bainbridge | b541504 | 2016-05-13 17:06:10 -0700 | [diff] [blame] | 76 | image: abh1nav/dockerui |
| 77 | name: dockerui |
| 78 | ports: 9000:9000 |
| 79 | privileged: yes |
| 80 | volumes: |
| 81 | - /var/run/docker.sock:/var/run/docker.sock |
| 82 | when: not skip_ui is defined |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 83 | tags: [docker] |