From 2b1114268c97d89133b042183e1a1096dc7f4311 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 12 May 2019 12:12:22 +0200 Subject: [PATCH] Add support for archlinux Signed-off-by: Knut Ahlers --- README.md | 1 + meta/main.yml | 2 ++ tasks/Archlinux.yml | 11 +++++++++++ tasks/Debian.yml | 5 +++++ tasks/Ubuntu.yml | 17 +++++++++++++++++ tasks/main.yml | 23 +++++++---------------- 6 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 tasks/Archlinux.yml create mode 100644 tasks/Debian.yml create mode 100644 tasks/Ubuntu.yml diff --git a/README.md b/README.md index 8d2b387..6321b33 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This role installs latest docker-compose on a host and start it as a systemd dae ## Requirements +- Archlinux - Debian >= 8 (jessie) - Ubuntu >= 16.04 (xenial) - Docker diff --git a/meta/main.yml b/meta/main.yml index 4aa530f..d990e3a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,6 +18,8 @@ galaxy_info: versions: - jessie - stretch + - name: Archlinux + versions: [all] categories: #- cloud diff --git a/tasks/Archlinux.yml b/tasks/Archlinux.yml new file mode 100644 index 0000000..ff9681d --- /dev/null +++ b/tasks/Archlinux.yml @@ -0,0 +1,11 @@ +--- + +- name: Install or update docker-compose + pacman: + name: docker-compose + state: latest + register: docker_compose + +- set_fact: docker_compose_binary_path="/usr/bin/docker-compose" + +... diff --git a/tasks/Debian.yml b/tasks/Debian.yml new file mode 100644 index 0000000..48cb971 --- /dev/null +++ b/tasks/Debian.yml @@ -0,0 +1,5 @@ +--- + +- include: Ubuntu.yml + +... diff --git a/tasks/Ubuntu.yml b/tasks/Ubuntu.yml new file mode 100644 index 0000000..e83bcdf --- /dev/null +++ b/tasks/Ubuntu.yml @@ -0,0 +1,17 @@ +--- + +- name: Ensure pip to be available + apt: + name: python-pip + cache_valid_time: 86400 + +- name: Install or update docker-compose + pip: + name: docker-compose + executable: pip + state: latest + register: docker_compose + +- set_fact: docker_compose_binary_path="/usr/local/bin/docker-compose" + +... diff --git a/tasks/main.yml b/tasks/main.yml index 891a9de..98e6d6f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,17 +2,8 @@ # Install docker-compose -- name: Ensure pip to be available - apt: - name: python-pip - cache_valid_time: 86400 - -- name: Install or update docker-compose - pip: - name: docker-compose - executable: pip - state: latest - register: docker_compose +- name: "Loading distribution specific instructions for {{ ansible_distribution }}" + include: "{{ ansible_distribution }}.yml" # Configure docker-compose @@ -51,13 +42,13 @@ Type=oneshot RemainAfterExit=yes - ExecStartPre=-/usr/local/bin/docker-compose pull --quiet --ignore-pull-failures - ExecStart=/usr/local/bin/docker-compose up -d --remove-orphans + ExecStartPre=-{{ docker_compose_binary_path }} pull --quiet --ignore-pull-failures + ExecStart={{ docker_compose_binary_path }} up -d --remove-orphans - ExecStop=/usr/local/bin/docker-compose {{ docker_compose_stop_action }} + ExecStop={{ docker_compose_binary_path }} {{ docker_compose_stop_action }} - ExecReload=/usr/local/bin/docker-compose pull --quiet --ignore-pull-failures - ExecReload=/usr/local/bin/docker-compose up -d --remove-orphans + ExecReload={{ docker_compose_binary_path }} pull --quiet --ignore-pull-failures + ExecReload={{ docker_compose_binary_path }} up -d --remove-orphans [Install] WantedBy=docker.service