Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 1 | - name: Debian add Docker repository and update apt cache |
| 2 | apt_repository: |
| 3 | repo: deb https://apt.dockerproject.org/repo ubuntu-{{ debian_version }} main |
| 4 | update_cache: yes |
| 5 | state: present |
| 6 | when: target == "installer" |
| 7 | tags: [docker] |
Sergio Slobodrian | ee4b2bc | 2017-06-05 10:08:59 -0400 | [diff] [blame] | 8 | |
Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 9 | - name: Debian Docker is present |
| 10 | apt: |
| 11 | name: docker-engine |
| 12 | state: latest |
| 13 | force: yes |
| 14 | when: target == "installer" |
| 15 | tags: [docker] |
| 16 | |
| 17 | - name: Debian python-pip is present |
| 18 | apt: |
| 19 | name: python-pip |
| 20 | state: present |
| 21 | when: target == "installer" |
| 22 | tags: [docker] |
| 23 | |
| 24 | - name: Debian docker-py is present |
| 25 | pip: |
| 26 | name: docker-py |
| 27 | version: "{{ docker_py_version }}" |
| 28 | state: present |
| 29 | when: target == "installer" |
| 30 | tags: [docker] |
| 31 | |
| 32 | - name: netifaces pip package is present |
| 33 | pip: |
| 34 | name: netifaces |
| 35 | version: "{{ netifaces_version }}" |
| 36 | state: present |
| 37 | when: target == "installer" |
| 38 | tags: [docker] |
| 39 | |
| 40 | - name: Docker config files are present |
| 41 | template: |
| 42 | src: "{{ docker_cfg }}" |
| 43 | dest: "{{ docker_cfg_dest }}" |
| 44 | register: copy_result |
| 45 | tags: [docker] |
| 46 | |
| 47 | - name: Debian Daemon is reloaded |
| 48 | command: systemctl daemon-reload |
| 49 | when: copy_result|changed and is_systemd is defined |
| 50 | tags: [docker] |
| 51 | |
| 52 | - name: Sudo user is added to the docker group |
| 53 | user: |
| 54 | name: "{{ ansible_env['SUDO_USER'] }}" |
| 55 | group: docker |
| 56 | register: user_result |
| 57 | tags: [docker] |
| 58 | |
| 59 | - name: Debian Docker service is restarted |
| 60 | service: |
| 61 | name: docker |
| 62 | state: restarted |
| 63 | when: copy_result|changed or user_result|changed |
| 64 | tags: [docker] |