diff --git a/roles/docker_setup/tasks/main.yml b/roles/docker_setup/tasks/main.yml index 2d3a475..43c8614 100644 --- a/roles/docker_setup/tasks/main.yml +++ b/roles/docker_setup/tasks/main.yml @@ -29,11 +29,15 @@ state: present - name: add Docker's APT repository - apt_repository: - repo: deb https://download.docker.com/linux/debian buster stable - state: present + ansible.builtin.template: + src: templates/docker.list.j2 + dest: /etc/apt/sources.list.d/docker.list + register: apt_repo + +- name: Update package cache + ansible.builtin.apt: update_cache: true - filename: "docker" + when: apt_repo.changed - name: install Docker package: diff --git a/roles/docker_setup/templates/docker.list.j2 b/roles/docker_setup/templates/docker.list.j2 new file mode 100644 index 0000000..7795847 --- /dev/null +++ b/roles/docker_setup/templates/docker.list.j2 @@ -0,0 +1,2 @@ +deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable +