diff --git a/docker/files/docker-compose b/docker/files/docker-compose new file mode 100755 index 0000000..4665469 --- /dev/null +++ b/docker/files/docker-compose @@ -0,0 +1,2 @@ +#!/bin/sh +docker compose $@ diff --git a/docker/handlers/main.yml b/docker/handlers/main.yml new file mode 100644 index 0000000..271f0b0 --- /dev/null +++ b/docker/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart_docker + service: + name: "docker" + state: restarted diff --git a/docker/tasks/main.yml b/docker/tasks/main.yml new file mode 100644 index 0000000..0c970fb --- /dev/null +++ b/docker/tasks/main.yml @@ -0,0 +1,40 @@ +#- name: Check if docker is already installed +# stat: +# path: /usr/bin/docker +# register: docker_file + +- name: Install Packages +# when: docker_file.stat.exists == False + package: + name: + - gpg + - gpg-agent + +- name: Add docker-key + apt_key: + url: https://download.docker.com/linux/debian/gpg + state: present + +- name: Add docker-repository + apt_repository: + repo: "deb https://download.docker.com/linux/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release }} stable" + state: present + filename: docker + update_cache: yes + +- name: Install docker + package: + name: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-compose-plugin + - pass + state: latest + +- name: Deploy docker-compose command to new docker compose plugin + ansible.builtin.copy: + src: docker-compose + dest: "/usr/local/bin/docker-compose" + mode: preserve +