| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| - name: Debian add Docker repository and update apt cache |
| apt_repository: |
| repo: deb https://apt.dockerproject.org/repo ubuntu-{{ debian_version }} main |
| update_cache: yes |
| state: present |
| when: target == "installer" |
| tags: [docker] |
| |
| - name: Debian Docker is present |
| apt: |
| name: docker-engine |
| state: latest |
| force: yes |
| when: target == "installer" |
| tags: [docker] |
| |
| - name: Debian python-pip is present |
| apt: |
| name: python-pip |
| state: present |
| when: target == "installer" |
| tags: [docker] |
| |
| - name: Debian docker-py is present |
| pip: |
| name: docker-py |
| version: "{{ docker_py_version }}" |
| state: present |
| when: target == "installer" |
| tags: [docker] |
| |
| - name: netifaces pip package is present |
| pip: |
| name: netifaces |
| version: "{{ netifaces_version }}" |
| state: present |
| when: target == "installer" |
| tags: [docker] |
| |
| - name: Docker config files are present |
| template: |
| src: "{{ docker_cfg }}" |
| dest: "{{ docker_cfg_dest }}" |
| register: copy_result |
| tags: [docker] |
| |
| - name: Debian Daemon is reloaded |
| command: systemctl daemon-reload |
| when: copy_result|changed and is_systemd is defined |
| tags: [docker] |
| |
| - name: Sudo user is added to the docker group |
| user: |
| name: "{{ ansible_env['SUDO_USER'] }}" |
| group: docker |
| register: user_result |
| tags: [docker] |
| |
| - name: Debian Docker service is restarted |
| service: |
| name: docker |
| state: restarted |
| when: copy_result|changed or user_result|changed |
| tags: [docker] |