From f6ccbbf5ebd7c862ab7cc06217bd9a1e2ebd4779 Mon Sep 17 00:00:00 2001 From: Fritz Grimpen Date: Tue, 17 Sep 2024 16:34:45 +0000 Subject: [PATCH] Add debian_docker role --- roles/debian_docker/defaults/main.yml | 0 roles/debian_docker/files/daemon.json | 3 +++ roles/debian_docker/handlers/main.yml | 5 ++++ roles/debian_docker/tasks/main.yml | 33 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 roles/debian_docker/defaults/main.yml create mode 100644 roles/debian_docker/files/daemon.json create mode 100644 roles/debian_docker/handlers/main.yml create mode 100644 roles/debian_docker/tasks/main.yml diff --git a/roles/debian_docker/defaults/main.yml b/roles/debian_docker/defaults/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/debian_docker/files/daemon.json b/roles/debian_docker/files/daemon.json new file mode 100644 index 0000000..194ce3b --- /dev/null +++ b/roles/debian_docker/files/daemon.json @@ -0,0 +1,3 @@ +{ + "log-driver": "journald" +} diff --git a/roles/debian_docker/handlers/main.yml b/roles/debian_docker/handlers/main.yml new file mode 100644 index 0000000..07aa0eb --- /dev/null +++ b/roles/debian_docker/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart docker + ansible.builtin.service: + name: docker + state: restarted diff --git a/roles/debian_docker/tasks/main.yml b/roles/debian_docker/tasks/main.yml new file mode 100644 index 0000000..a910155 --- /dev/null +++ b/roles/debian_docker/tasks/main.yml @@ -0,0 +1,33 @@ +--- +- name: Install Docker's GPG key in apt's keyring + ansible.builtin.apt_key: + url: https://download.docker.com/linux/debian/gpg + state: present + tags: docker install + +- name: Setup Docker's apt repository + ansible.builtin.apt_repository: + repo: deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable + state: present + filename: docker + tags: docker install + +- name: Install Docker + ansible.builtin.package: + name: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-compose-plugin + state: present + tags: docker install + notify: + - Restart docker + +- name: Configure Docker daemon + ansible.builtin.file: + src: daemon.json + dest: /etc/docker/daemon.json + owner: root + group: root + mode: '0644'