#StackBounty: #ubuntu #ansible No package matching 'docker-ce' is available with ansible

Bounty: 50

On ubuntu 18.04 I am running this ansible (version 2.5.1) role:

- name: Add Docker apt repository key.
    url: "https://download.docker.com/linux/ubuntu/gpg"
    state: present

- name: gather facts

- name: Set the stable docker repository
    repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
    state: present
    update_cache: yes    

- name: Install Docker
    name: docker-ce
    state: present

With this playbook:


- hosts: localhost
  connection: local
  gather_facts: False
  become: true

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

  - name: Install list of packages
    apt: name={{item}} state=latest
         - nano
         - git
         - htop
         - gitg

      - {role: 'docker', tags: 'docker'}

But I get the following error:

PLAY [localhost] *******************************************************************************************************************************

TASK [Install python for Ansible] **************************************************************************************************************
changed: [localhost]

TASK [docker : Add Docker apt repository key.] *************************************************************************************************
ok: [localhost]

TASK [docker : gather facts] *******************************************************************************************************************
ok: [localhost]

TASK [docker : Set the stable docker repository] ***********************************************************************************************
ok: [localhost]

TASK [docker : Install Docker] *****************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "No package matching 'docker-ce' is available"}
    to retry, use: --limit @/home/user/repos/ansible-vps/src/ansible_create_workstation.retry

PLAY RECAP *************************************************************************************************************************************
localhost                  : ok=4    changed=1    unreachable=0    failed=1   

So for some reason the docker-ce package cannot be found, has that changed recently or is it something else I am doing wrong?

Also when I look in: /etc/apt/sources.list it does not contain a:

deb [arch=amd64] https://download.docker.com/linux/ubuntu  ...


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.