Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 14 | - name: Debian add Docker repository and update apt cache |
| 15 | apt_repository: |
| 16 | repo: deb https://apt.dockerproject.org/repo ubuntu-{{ debian_version }} main |
| 17 | update_cache: yes |
| 18 | state: present |
| 19 | tags: [docker] |
| 20 | |
| 21 | - name: Debian Docker is present |
| 22 | apt: |
| 23 | name: docker-engine |
| 24 | state: latest |
| 25 | force: yes |
| 26 | tags: [docker] |
| 27 | |
| 28 | - name: Debian python-pip is present |
| 29 | apt: name=python-pip state=present |
| 30 | tags: [docker] |
| 31 | |
| 32 | - name: Debian docker-py is present |
| 33 | pip: |
| 34 | name: docker-py |
| 35 | version: 1.6.0 |
| 36 | state: present |
| 37 | tags: [docker] |
| 38 | |
Nathan Knuth | 676ebbb | 2016-10-13 22:16:10 -0700 | [diff] [blame] | 39 | - name: netifaces pip package is present |
| 40 | pip: |
| 41 | name: netifaces |
| 42 | version: 0.10.4 |
| 43 | state: present |
| 44 | tags: [docker] |
| 45 | |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 46 | - name: Debian files are present |
| 47 | template: |
| 48 | src: "{{ docker_cfg }}" |
| 49 | dest: "{{ docker_cfg_dest }}" |
| 50 | register: copy_result |
| 51 | tags: [docker] |
| 52 | |
Sergio Slobodrian | 9521fed | 2017-05-30 16:31:21 -0400 | [diff] [blame] | 53 | - name: Enable insecure install registry |
| 54 | template: |
| 55 | src: "{{ docker_daemon_json }}" |
| 56 | dest: "{{ docker_daemon_json_dest }}" |
| 57 | register: copy_result |
| 58 | tags: [docker] |
| 59 | |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 60 | - name: Debian Daemon is reloaded |
| 61 | command: systemctl daemon-reload |
| 62 | when: copy_result|changed and is_systemd is defined |
| 63 | tags: [docker] |
| 64 | |
| 65 | - name: vagrant user is added to the docker group |
| 66 | user: |
| 67 | name: "{{ ansible_env['SUDO_USER'] }}" |
| 68 | group: docker |
| 69 | register: user_result |
| 70 | tags: [docker] |
| 71 | |
| 72 | - name: Debian Docker service is restarted |
| 73 | service: |
| 74 | name: docker |
| 75 | state: restarted |
| 76 | when: copy_result|changed or user_result|changed |
| 77 | tags: [docker] |