将 Docker 存储库添加到 APT 源时出现错误

error seen while adding Docker Repository to APT sources

我正在尝试使用 ansible 脚本将 docker 存储库添加到 ubuntu 16.04 上的 APT 源:

 - name: Add Docker Repository to APT sources
      apt_repository:
          repo: "{{ docker_apt_repository_details }}"
          update_cache: yes
          state: present
      become: true

其中,docker_apt_repository_details 定义为:

docker_apt_repository_details: deb https://apt.dockerproject.org/repo ubuntu-xenial main

但是,观察到以下错误,请注意,已完成的 ansible 脚本没有任何变化,一个月前它运行良好。请建议如何解决这个问题?

module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_soFQp0/ansible_module_apt_repository.py\", line 556, in <module>\r\n    main()\r\n  File \"/tmp/ansible_soFQp0/ansible_module_apt_repository.py\", line 544, in main\r\n    cache.update()\r\n  File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 522, in update\r\n    raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:The repository 'https://apt.dockerproject.org/repo ubuntu-xenial Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Packages  404  Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.\r\n", 
21:38:11                "msg": "MODULE FAILURE",

以下是失败任务之前使用的任务集:

- name: Install Python 2.7.12
     raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

   - name: Install pip
     apt:
         name: python-pip
         update_cache: yes
         state: latest
     become: true
     become_method: sudo

   - name: Update ubuntu image
     apt:
         update_cache: yes
     become: true

   - name: Ensure APT works with https method
     apt:
         name: "apt-transport-https"
         update_cache: yes
         state: latest
     become: true

   - name: Install CA certificates
     apt:
         name: "ca-certificates"
         update_cache: yes
         state: latest
     become: true

   - name: Add official Docker repository GPG key
     apt_key:
         keyserver: "{{ docker_apt_key_url }}"
         id: "{{ docker_apt_key_id }}"
         state: present
     become: true

   - name: Add Docker Repository to APT sources
     apt_repository:
         repo: "{{ docker_apt_repository_details }}"
         update_cache: yes
         state: present
     become: true```

dockerproject.org APT 和 YUM 存储库已关闭:

Notice: Shutting down dockerproject.org APT and YUM repos 2020-03-31 Docker will be shutting down the deprecated APT and YUM repositories hosted at "dockerproject.org" and "dockerproject.com" on the 31st of March 2020.

We noticed that this project is referencing one of these repositories, and recommend updating to use the "download.docker.com" repository to prevent disruption.

More info: https://www.docker.com/blog/changes-dockerproject-org-apt-yum-repositories/

-- https://apt.dockerproject.org/repo