Closed mkarlesky closed 3 years ago
Hi,
For clarity did you successfully run it on a fresh Vagrant box on the first run, or did you always need to run it twice because the first time had the error?
Did you run an apt-get update
before the first run at any point in time outside this role? That's typically something that you would run on any Ansible managed server beforehand during a bootstrap process.
You can see in this CI run https://github.com/nickjj/ansible-docker/runs/1631249824?check_suite_focus=true, the playbook and role runs against Ubuntu 18.04 successfully and is also idempotent.
Thank you for the quick response and for your work on this role.
Things have worked fine on a fresh Vagrant box. No second run needed. Given that experience I expected to see the same on real hardware. I assumed the appropriate package update was happening in the role somewhere.
I have another clean Ubuntu 18.04 hardware box I'll be running the same process against shortly. I've added an apt-get update
pretask to my playbook as you've suggested. I'll report back when I've run the process. Surely, you've identified the issue here.
Thanks again.
No problem.
The reason apt-get update
isn't added to this role specifically is because let's say you have 8 roles that all apt install something. It ends up being a huge time sink to have each role run their own apt update and coordinating an apt cache variable across every role isn't the best pattern either (I used to do that 5ish years ago).
Plus, to bootstrap a role to run Ansible typically you're installing python3
and depending on how bare bones your distro is, sudo
, lsb-release
and other things too. All of which require running an apt update there. I handle those things in a dedicated "bootstrap" role which is the first role that runs on the system.
Going to close this as I believe it would be fixed.
Feel free to re-open it if it doesn't after you check it out.
pre_tasks:
- name: Run the equivalent of "apt-get update"
apt:
update_cache: true
changed_when: false
Incredibly, the very same problem occurred on the other clean Ubuntu 18.04 hardware box. I even copied your apt-get update
pre_task into my playbook verbatim, and I see that the task ran when executing Docker set up. Once again a second execution yielded successful installation and configuration.
Which Vagrant box are you using?
For refence it's passing on Ubuntu 18.04 in the CI run and I just spun up an Ubuntu 18.04 LTS server on DigitalOcean and AWS and in both cases it ran through successfully on the first run using this as the inventory configuration:
---
docker__registries:
- username: "[redacted]"
password: "[redacted]"
docker__default_pip_packages:
# Don't install docker-compose
- name: docker-compose
state: absent
# Ooverriding the defaults to omit the preceding requires this be explicit
- name: docker
state: present
The only thing I did prior to the run was make sure python3
is installed. I also used v2.1.0 of this role which I pushed yesterday. It sets the virtualenv interpreter on the pip install task to use python3 instead of having to explicitly set the ansible interpreter.
But I don't think the interpreter is the issue here because yours is stalling out in the Install Docker task which is before the pip install task.
Do you have any roles that might be installing Docker before this role, or are using some Vagrant box that has Docker pre-installed?
Things have worked fine with Vagrant boxes. These errors are happening only with real world hardware boxes. I'm developing with Vagrant and deploying to real hardware. The issue is happening only on the real hardware—now two different clean boxes. The boxes are mini-PCs from System76 with Ubuntu pre-installed.
Docker is definitely not installed. These are brand new machines with only a bare minimum of set up for ssh. Python3 is installed. I am using the 2.0.0 version of the role from Galaxy.
If there's an inventory or environment dump from these machines I can provide I'm happy to do so. As far as I know they're pretty standard machines and once set up everything else has been working fine. I'm just hitting this odd package dependency issue.
I'd guess I'm missing some necessary set up step that for whatever reason isn't necessary in Vagrant or DigitalOcean contexts.
Thanks for the support. I'm at a loss on the issue, and the problem is likely not with the role given how much it's exercised elsewhere.
After Googling your error I see this open issue from Docker: https://github.com/moby/moby/issues/41792
Is your box connected to a VPN? That's one potential case based on a few upvotes in that thread.
iptables being misconfigured is another, and there's steps to maybe fix it based on https://stackoverflow.com/a/22876662 being linked in the issue a few times.
Have you also rebooted your box before attempting to install Docker? Maybe initially installing Docker kicks something off that allows it to work the 2nd time around. I don't know how System76 sets up their systems and I don't have one of their Ubuntu ISOs to test it against.
I suppose we'll just need to leave this as an unsolved mystery.
There's no VPN involved. As part of the minimal set up before switching to Ansible I applied all available patches and rebooted. There may be some iptable issue, but all networking has been working fine otherwise.
I can't see a way to definitively recreate the problem without purchasing a new machine from the same vendor, and two machines is all we need for this particular project. I strongly suspect trying to roll things back and try again will be a fruitless exercise.
Thanks again for the help and for the role. I imagine we'll have better luck the next time we use it.
Thanks for the report. I'm not a fan of unsolved mysteries but if it works in the end after a 2nd run that's always a plus.
Issue
I recently used the nickjj.docker v2.0.0 Ansible role to install Docker on a clean Ubuntu 18.04 machine. On my first attempt the installation process errored out with a package dependency problem (see below).
I have successfully installed Docker on Ubuntu 18.04 using the nickjj.docker role in these two scenarios:
Playbook
Ansible output