Add Docker Machine

Signed-off-by: Guo Qiao <guoqiao@gmail.com>
This commit is contained in:
Guo Qiao 2019-03-07 10:41:14 +13:00
parent 5afc0f8ab4
commit b9c9612970
3 changed files with 27 additions and 0 deletions

View File

@ -14,6 +14,10 @@ docker_install_compose: true
docker_compose_version: "1.22.0"
docker_compose_path: /usr/local/bin/docker-compose
docker_install_machine: true
docker_machine_version: "v0.16.1"
docker_machine_path: /usr/local/bin/docker-machine
# Used only for Debian/Ubuntu. Switch 'stable' to 'edge' if needed.
docker_apt_release_channel: stable
docker_apt_arch: amd64

20
tasks/docker-machine.yml Normal file
View File

@ -0,0 +1,20 @@
---
- name: Check current docker-machine version.
command: docker-machine --version
register: docker_machine_current_version
changed_when: false
failed_when: false
- name: Delete existing docker-machine version if it's different.
file:
path: "{{ docker_machine_path }}"
state: absent
when: >
docker_machine_current_version.stdout is defined
and docker_machine_version not in docker_machine_current_version.stdout
- name: Install Docker Machine (if configured).
get_url:
url: https://github.com/docker/machine/releases/download/{{ docker_machine_version }}/docker-machine-Linux-x86_64
dest: "{{ docker_machine_path }}"
mode: 0755

View File

@ -27,5 +27,8 @@
- include_tasks: docker-compose.yml
when: docker_install_compose
- include_tasks: docker-machine.yml
when: docker_install_machine
- include_tasks: docker-users.yml
when: docker_users