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