From 29faea7843ffa00ebd1b9618ac57e3f949775caf Mon Sep 17 00:00:00 2001 From: clyhtsuriva Date: Fri, 7 Mar 2025 21:02:34 +0100 Subject: ansible: Add tasks to clone docker subfolder in docker role --- ansible/roles/docker/tasks/install_docker.yml | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 ansible/roles/docker/tasks/install_docker.yml (limited to 'ansible/roles/docker/tasks/install_docker.yml') diff --git a/ansible/roles/docker/tasks/install_docker.yml b/ansible/roles/docker/tasks/install_docker.yml new file mode 100644 index 0000000..37d9b4d --- /dev/null +++ b/ansible/roles/docker/tasks/install_docker.yml @@ -0,0 +1,44 @@ +--- +- name: Set Docker repository variables based on OS + ansible.builtin.set_fact: + docker_repo: "{{ docker_repos[ansible_distribution] }}" + docker_gpg_key_url: "{{ docker_gpg_keys[ansible_distribution] }}" + +- name: Install required dependencies + ansible.builtin.apt: + name: "{{ docker_dependencies }}" + state: present + update_cache: true + +- name: Ensure /etc/apt/keyrings directory exists + ansible.builtin.file: + path: /etc/apt/keyrings + state: directory + mode: '0755' + +- name: Download and add Docker GPG key + ansible.builtin.get_url: + url: "{{ docker_gpg_key_url }}" + dest: /etc/apt/keyrings/docker.asc + mode: '0644' + +- name: Add Docker repository + ansible.builtin.apt_repository: + repo: >- + deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] + {{ docker_repo }} {{ ansible_distribution_release }} stable + state: present + filename: docker + +- name: Install Docker packages + ansible.builtin.apt: + name: "{{ docker_packages }}" + state: present + update_cache: true + +- name: Ensure Docker service is started and enabled + ansible.builtin.systemd: + name: docker + state: started + enabled: true +... -- cgit v1.2.3