nickjj / ansible-docker

Install / Configure Docker and Docker Compose using Ansible.
MIT License
750 stars 224 forks source link

v2.0.0 Failed on ubuntu 18.04 #89

Closed debonzi closed 4 years ago

debonzi commented 4 years ago

Using with the .yml

---
- name: Docker Server
  hosts: "all"
  become: true
  roles:
    - role: "nickjj.docker"
      tags: ["docker"]

I got the result:

$ ansible-playbook sciencedesk-docker.yml 

PLAY [Docker Server] ****************************************************************

TASK [Gathering Facts] ************************************
ok: [sandbox.sciencedesk.net]

TASK [nickjj.docker : Disable pinned Docker version] ***************************************************************
ok: [sandbox.sciencedesk.net]

TASK [nickjj.docker : Enable pinned Docker version] ***************************************************************
skipping: [sandbox.sciencedesk.net]

TASK [nickjj.docker : Install Docker's dependencies] ***************************************************************
fatal: [sandbox.sciencedesk.net]: FAILED! => {"changed": false, "msg": "No package matching 'gnupg2' is available"}

PLAY RECAP ***************************************************************
sandbox.sciencedesk.net    : ok=2    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0  
debonzi commented 4 years ago

I maybe have been to quick opening the issue. I tried to downgrade to v1.9.2 and got the same error. However I used it some days ago and it have worked just fine.

I will gladly provide more information if required.

debonzi commented 4 years ago

Just a bit more information: executing sudo apt-get update on the target host seems to solve the problem. Doesnt this role execute sudo apt-get update before try to install docker dependecies?

I am pretty new to ansible so I maybe doing something wrong.

nickjj commented 4 years ago

Hi,

Typically you'd run sudo apt-get update on a host during its initial set up phase where you get Ansible ready to run on it.

This has been discussed in more detail at https://github.com/nickjj/ansible-docker/issues/73#issuecomment-582956487 for the reason why this role doesn't control running that update for you initially.