feat: install docker-compose with binary

This commit is contained in:
Adrien Waksberg 2018-12-23 11:28:27 +01:00
parent 18426c8173
commit 71e4cbd246
4 changed files with 16 additions and 9 deletions

View file

@ -10,6 +10,7 @@ Install and configure docker service
## Role variables ## Role variables
* `docker_compose_version` - set the docker-compose version to install (default: `1.23.2`)
* `docker_services` - hash with the docker-compose configuration (see [docker documentation](https://docs.docker.com/compose/compose-file/compose-file-v2/#service-configuration-reference)) * `docker_services` - hash with the docker-compose configuration (see [docker documentation](https://docs.docker.com/compose/compose-file/compose-file-v2/#service-configuration-reference))
``` ```

View file

@ -1,2 +1,4 @@
--- ---
docker_compose_version: 1.23.2
docker_compose_url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
docker_services: {} docker_services: {}

View file

@ -20,13 +20,22 @@
repo: 'deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable' repo: 'deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable'
tags: docker tags: docker
- name: install docker packages - name: install docker package
apt: apt:
name: '{{ packages }}' name: '{{ packages }}'
vars: vars:
packages: packages:
- docker-ce - docker-ce
- docker-compose tags: docker
- name: install docker-compose binary
get_url:
url: '{{ docker_compose_url }}'
dest: /usr/bin/docker-compose
checksum: 'sha256:{{ docker_compose_url }}.sha256'
owner: root
group: root
mode: 0755
tags: docker tags: docker
- name: copy systemd service - name: copy systemd service

View file

@ -7,14 +7,9 @@ puts '================================'
puts %x(ansible --version) puts %x(ansible --version)
puts '================================' puts '================================'
%w[ describe package('docker-ce') do
docker-ce
docker-compose
].each do |name|
describe package(name) do
it { should be_installed } it { should be_installed }
end end
end
describe file('/etc/docker/compose/test/docker-compose.yml') do describe file('/etc/docker/compose/test/docker-compose.yml') do
it { should exist } it { should exist }