| --- |
| |
| - name: Trust docker apt key |
| apt_key: |
| data={{ lookup('file', 'docker_apt_key.gpg') }} |
| |
| - name: Debian add Docker repository and update apt cache |
| apt_repository: |
| repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" |
| update_cache: yes |
| state: present |
| tags: [docker] |
| |
| - name: Debian Docker is present |
| apt: |
| name: "docker-ce=17.06.*" |
| state: present |
| force: yes |
| tags: [docker] |
| |
| - name: Debian python-pip is present |
| apt: name=python-pip state=present |
| tags: [docker] |
| |
| - name: Debian docker-py is present |
| pip: |
| name: "docker==2.4.2" |
| state: present |
| tags: [docker] |
| |
| - name: Debian 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: vagrant user is added to the docker group |
| user: |
| name: vagrant |
| 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] |
| |
| - name: DockerUI is running |
| docker_container: |
| image: abh1nav/dockerui |
| name: dockerui |
| ports: 9000:9000 |
| privileged: yes |
| volumes: |
| - /var/run/docker.sock:/var/run/docker.sock |
| when: not skip_ui is defined |
| tags: [docker] |