From 9a62b70c598f4c4f67d4154c6fb57a6f204e5401 Mon Sep 17 00:00:00 2001 From: nouchka Date: Sun, 6 Jan 2019 20:37:07 +0100 Subject: [PATCH] add docker-app with completion --- defaults/main.yml | 8 +++++++- tasks/docker-app.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ tasks/main.yml | 3 +++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tasks/docker-app.yml diff --git a/defaults/main.yml b/defaults/main.yml index dd9a7c5..74780fa 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,10 +11,16 @@ docker_restart_handler_state: restarted # Docker Compose options. docker_install_compose: true -docker_compose_version: "1.22.0" +docker_compose_version: "1.23.2" docker_compose_path: /usr/local/bin/docker-compose docker_compose_completion_path: /etc/bash_completion.d/docker-compose +# Docker App options. +docker_install_app: true +docker_app_version: "v0.6.0" +docker_app_path: /usr/local/bin/docker-app +docker_app_completion_path: /etc/bash_completion.d/docker-app + # Used only for Debian/Ubuntu. Switch 'stable' to 'edge' if needed. docker_apt_release_channel: stable docker_apt_arch: amd64 diff --git a/tasks/docker-app.yml b/tasks/docker-app.yml new file mode 100644 index 0000000..1eceb26 --- /dev/null +++ b/tasks/docker-app.yml @@ -0,0 +1,42 @@ +--- +- name: Check current docker-app version. + command: docker-app --version + register: docker_app_current_version + changed_when: false + failed_when: false + check_mode: false + +- name: Delete existing docker-app version if it's different. + file: + path: "{{ docker_app_path }}" + state: absent + when: > + docker_app_current_version.stdout is defined + and docker_app_version not in docker_app_current_version.stdout + +- name: Download Docker app (if configured). + unarchive: + src: https://github.com/docker/app/releases/download/{{ docker_app_version }}/docker-app-linux.tar.gz + dest: "/tmp" + remote_src: yes + when: > + docker_app_current_version.stdout is defined + and docker_app_version not in docker_app_current_version.stdout + or not docker_app_current_version.stdout is defined + +- name: Install Docker app (if configured). + copy: + src: /tmp/docker-app-linux + dest: "{{ docker_app_path }}" + remote_src: yes + mode: 0755 + when: > + docker_app_current_version.stdout is defined + and docker_app_version not in docker_app_current_version.stdout + or not docker_app_current_version.stdout is defined + +- name: Install Docker app completion + shell: "docker-app completion >> {{ docker_app_completion_path }}" + args: + creates: "{{ docker_app_completion_path }}" + diff --git a/tasks/main.yml b/tasks/main.yml index f248279..3d2b62c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,5 +27,8 @@ - include_tasks: docker-compose.yml when: docker_install_compose +- include_tasks: docker-app.yml + when: docker_install_app + - include_tasks: docker-users.yml when: docker_users