Add docker-wrapper method for docker-compose

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-11-26 15:17:24 +01:00
parent bea851e179
commit a68be104dc
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 27 additions and 0 deletions

View file

@ -5,6 +5,7 @@ docker_compose_stop_action: down
docker_compose_validate: true
docker_compose_reload_max_delay: 0 # Have no delay, should be less than docker_compose_reload_minutes
docker_compose_use_docker_image: false
docker_compose_add_cleanjob: false
docker_compose_config:

21
tasks/docker-wrapper.yml Normal file
View file

@ -0,0 +1,21 @@
---
- name: Install wrapper script
copy:
content: |
#!/bin/bash
set -euo pipefail
exec docker run --rm -ti \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "/etc/docker-compose:/etc/docker-compose:ro" \
luzifer/docker-compose \
"$@"
dest: /usr/local/bin/docker-compose
group: root
mode: '0755'
owner: root
- set_fact: docker_compose_binary_path="/usr/local/bin/docker-compose"
...

View file

@ -4,6 +4,11 @@
- name: "Loading distribution specific instructions for {{ ansible_distribution }}"
include: "{{ ansible_distribution }}.yml"
when: not docker_compose_use_docker_image
- name: Install shell wrapper for docker-compose image
include: "docker-wrapper.yml"
when: docker_compose_use_docker_image
# Configure docker-compose