mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-31 09:04:49 +00:00
Replace apt_repository with deb822_repository.
This commit is contained in:
parent
e02d4d06af
commit
e877111e87
@ -9,38 +9,32 @@
|
|||||||
|
|
||||||
- name: Install pre-reqs
|
- name: Install pre-reqs
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: '{{ docker_prereq_packages }}'
|
name: '{{ docker_prereq_packages + ["python3-debian"] }}'
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
notify: cleanup docker
|
notify: cleanup docker
|
||||||
|
|
||||||
- when:
|
- name: Add Docker repo on Ubuntu or Debian
|
||||||
- (ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int) >= 22) or
|
ansible.builtin.deb822_repository:
|
||||||
(ansible_facts.distribution == "Debian" and (ansible_facts.distribution_major_version | int) >= 12)
|
name: docker
|
||||||
name: Add Docker repo on Ubuntu 22+ or Debian 12+
|
types: deb
|
||||||
block:
|
architectures:
|
||||||
- name: Add gpg key
|
- >-
|
||||||
ansible.builtin.get_url:
|
{{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64' }}
|
||||||
url: "https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}/gpg"
|
signed_by: "https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}/gpg"
|
||||||
dest: /etc/apt/keyrings/docker.asc
|
uris:
|
||||||
|
- https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}
|
||||||
|
suites:
|
||||||
|
- "{{ ansible_facts.distribution_release }}"
|
||||||
|
components:
|
||||||
|
- stable
|
||||||
|
state: present
|
||||||
|
register: apt_repo
|
||||||
|
|
||||||
- name: Add Docker repo
|
- name: Update apt cache
|
||||||
ansible.builtin.apt_repository:
|
ansible.builtin.apt:
|
||||||
repo: deb [arch={{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64' }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release }} stable
|
update_cache: true
|
||||||
state: present
|
when: apt_repo is changed
|
||||||
|
|
||||||
- when:
|
|
||||||
- (ansible_facts.distribution == "Ubuntu" and (ansible_facts.distribution_major_version | int) < 22) or
|
|
||||||
(ansible_facts.distribution == "Debian" and (ansible_facts.distribution_major_version | int) < 12)
|
|
||||||
name: Add Docker repo on Ubuntu 20 or before, or Debian 11 or before
|
|
||||||
block:
|
|
||||||
- name: Add gpg key
|
|
||||||
ansible.builtin.shell: curl -fsSL https://download.docker.com/linux/{{ ansible_facts.distribution | lower }}/gpg >key && apt-key add key # noqa: command-instead-of-module
|
|
||||||
|
|
||||||
- name: Add Docker repo
|
|
||||||
ansible.builtin.apt_repository:
|
|
||||||
repo: deb [arch={{ 'arm64' if ansible_facts.architecture == 'aarch64' else 'amd64' }}] https://download.docker.com/linux/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release }} stable
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Prevent service restart
|
- name: Prevent service restart
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user