diff --git a/defaults/main.yml b/defaults/main.yml index 863d74f..9771cf3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,7 +3,7 @@ docker_package: "docker-engine" # Docker Compose options. docker_install_compose: true -docker_compose_version: "1.11.2" +docker_compose_version: "1.13.0" # Used only for Debian/Ubuntu. Add 'testing' if you don't want stable. docker_apt_repository: "deb https://apt.dockerproject.org/repo {{ ansible_distribution|lower }}-{{ ansible_distribution_release }} main" diff --git a/tasks/docker-compose.yml b/tasks/docker-compose.yml new file mode 100644 index 0000000..5b4fb8e --- /dev/null +++ b/tasks/docker-compose.yml @@ -0,0 +1,18 @@ +--- +- name: Check current docker-compose version. + command: docker-compose --version + register: docker_compose_current_version + changed_when: false + failed_when: false + +- name: Delete existing docker-compose version if it's different. + file: + path: /usr/local/bin/docker-compose + state: absent + when: docker_compose_version not in docker_compose_current_version.stdout + +- name: Install Docker Compose (if configured). + get_url: + url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 + dest: /usr/local/bin/docker-compose + mode: 0755 diff --git a/tasks/main.yml b/tasks/main.yml index 985c8ad..9abd2ed 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,9 +14,5 @@ state: started enabled: yes -- name: Install Docker Compose (if configured). - get_url: - url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 - dest: /usr/local/bin/docker-compose - mode: 0755 +- include: docker-compose.yml when: docker_install_compose