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. |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [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 | when: target == "installer" |
| 20 | tags: [docker] |
Sergio Slobodrian | ee4b2bc | 2017-06-05 10:08:59 -0400 | [diff] [blame] | 21 | |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 22 | - name: Debian Docker is present |
| 23 | apt: |
| 24 | name: docker-engine |
| 25 | state: latest |
| 26 | force: yes |
| 27 | when: target == "installer" |
| 28 | tags: [docker] |
| 29 | |
| 30 | - name: Debian python-pip is present |
| 31 | apt: |
| 32 | name: python-pip |
| 33 | state: present |
| 34 | when: target == "installer" |
| 35 | tags: [docker] |
| 36 | |
| 37 | - name: Debian docker-py is present |
| 38 | pip: |
| 39 | name: docker-py |
| 40 | version: "{{ docker_py_version }}" |
| 41 | state: present |
| 42 | when: target == "installer" |
| 43 | tags: [docker] |
| 44 | |
| 45 | - name: netifaces pip package is present |
| 46 | pip: |
| 47 | name: netifaces |
| 48 | version: "{{ netifaces_version }}" |
| 49 | state: present |
| 50 | when: target == "installer" |
| 51 | tags: [docker] |
| 52 | |
| 53 | - name: Docker config files are present |
| 54 | template: |
| 55 | src: "{{ docker_cfg }}" |
| 56 | dest: "{{ docker_cfg_dest }}" |
| 57 | register: copy_result |
| 58 | tags: [docker] |
| 59 | |
| 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: Sudo 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] |