From 1aa9b87ea5124fae92ce862563aa3e279cff6712 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 1 Aug 2022 23:27:30 +0100 Subject: [PATCH] adding docker-compose and pull pre-requisite images before backups --- ansible/homelab/playbooks/restore-all.yml | 4 ++-- ansible/homelab/playbooks/setup-home-lab.yml | 2 +- ansible/homelab/tasks/install-docker-tasks.yml | 8 +++++++- ansible/homelab/tasks/restore-volume-tasks.yml | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ansible/homelab/playbooks/restore-all.yml b/ansible/homelab/playbooks/restore-all.yml index 37261a0..073c0c5 100644 --- a/ansible/homelab/playbooks/restore-all.yml +++ b/ansible/homelab/playbooks/restore-all.yml @@ -17,7 +17,7 @@ vars_files: - ../variables.yml tasks: - - name: Restore Tautulli + - name: Restore Portainer import_tasks: ../tasks/restore-volume-tasks.yml vars: - container_name: "tautulli" + container_name: "portainer" diff --git a/ansible/homelab/playbooks/setup-home-lab.yml b/ansible/homelab/playbooks/setup-home-lab.yml index 9476411..e2f0568 100644 --- a/ansible/homelab/playbooks/setup-home-lab.yml +++ b/ansible/homelab/playbooks/setup-home-lab.yml @@ -30,4 +30,4 @@ - name: Start Portainer tags: "skip-e2e" # we can't mount volumes on test runners. - command: "chdir={{home_lab_checkout_dir}}/docker-compose/portainer docker compose up -d" + command: "chdir={{home_lab_checkout_dir}}/docker-compose/portainer docker-compose up -d" diff --git a/ansible/homelab/tasks/install-docker-tasks.yml b/ansible/homelab/tasks/install-docker-tasks.yml index 9894c97..3789f7a 100644 --- a/ansible/homelab/tasks/install-docker-tasks.yml +++ b/ansible/homelab/tasks/install-docker-tasks.yml @@ -30,4 +30,10 @@ - name: Install Docker Module for Python pip: - name: docker \ No newline at end of file + name: docker + +- name: Install docker-compose + get_url: + url : https://github.com/docker/compose/releases/download/1.25.1-rc1/docker-compose-Linux-x86_64 + dest: /usr/local/bin/docker-compose + mode: 'u+x,g+x' \ No newline at end of file diff --git a/ansible/homelab/tasks/restore-volume-tasks.yml b/ansible/homelab/tasks/restore-volume-tasks.yml index 20bd136..9fe99bd 100644 --- a/ansible/homelab/tasks/restore-volume-tasks.yml +++ b/ansible/homelab/tasks/restore-volume-tasks.yml @@ -1,4 +1,18 @@ --- +# The docker volume backup image utilizes these images +- name: Pull ubuntu + docker_image: + name: ubuntu + source: pull +- name: Pull busybox + docker_image: + name: busybox + source: pull +- name: Pull docker-volume-backup + docker_image: + name: {{docker_volume_backup_image}} + source: pull + # https://stackoverflow.com/questions/45237632/ansible-w-docker-show-current-container-state - name: Get container info docker_container_info: