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