ansible-role-k3s/tasks/build/docker/debian/install-prerequisites.yml

30 lines
1.1 KiB
YAML

---
- name: Ensure Docker prerequisites are installed
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- "{{ 'gnupg2' if k3s_os_distribution == 'debian' else 'gnupg-agent' }}"
- software-properties-common
state: present
register: ensure_docker_prerequisites_installed
until: ensure_docker_prerequisites_installed is succeeded
retries: 3
delay: 10
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
- name: Ensure Docker APT key is present
ansible.builtin.apt_key:
url: https://download.docker.com/linux/{{ k3s_os_distribution }}/gpg
state: present
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"
- name: Ensure Docker repository is installed and configured
ansible.builtin.apt_repository:
filename: docker-ce
repo: "deb https://download.docker.com/linux/{{ k3s_os_distribution }} {{ ansible_distribution_release }} stable"
update_cache: true
become: "{{ k3s_become_for_package_install | ternary(true, false, k3s_become_for_all) }}"