Code Monkey home page Code Monkey logo

Comments (6)

nickjj avatar nickjj commented on June 12, 2024 2

That leads you down a pretty deep rabbit hole. Docker probably isn't the only role you're using. You may have 2, 5, or even 20 other roles that maybe potentially require apt installing a package.

If you put an apt-get update in all of them then it's going to drastically slow down your Ansible run because it takes a long time for that command to run. It's super inefficient to run that command 5 times within 2 minutes on a first run.

Ansible lets you solve this problem by configuring a cache time to avoid re-running until the cache expires, but now suddenly every role needs a configurable apt cache time. This is something I used to do 3-4 years ago but after working with many dozens of roles, I found this pattern to be a huge problem.

IMO it's a lot nicer to have the concept of a "bootstrap" role that does things like bootstrapping your server to run Ansible, enable Ubuntu's universe repos and do an initial apt-get update. Then it's all managed in 1 spot and you can let the system manage the internals of regularly running apt-get update if you want to keep things fresh.

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

Have you run an apt-get update on your server before?

It would be expected that you do.

from ansible-docker.

shoe-diamente avatar shoe-diamente commented on June 12, 2024

I'm sorry, this is my first time with Ansible. Just curious, why isn't the apt-get update command specified in the role already?

from ansible-docker.

shoe-diamente avatar shoe-diamente commented on June 12, 2024

I see, thanks for the explanation.
I've apt-get updated the vagrant server.
Now it stops at:

TASK [nickjj.docker : Install Docker] ******************************************
fatal: [machine1]: FAILED! => {"changed": false, "msg": "No package matching 'docker-ce' is available"}

The whole output is:

TASK [Install Docker and Docker-Compose] ***************************************

TASK [nickjj.docker : Disable pinned Docker version] ***************************
ok: [machine1]

TASK [nickjj.docker : Enable pinned Docker version] ****************************
skipping: [machine1]

TASK [nickjj.docker : Install Docker's dependencies] ***************************
changed: [machine1]

TASK [nickjj.docker : Add Docker's public GPG key to the APT keyring] **********
changed: [machine1]

TASK [nickjj.docker : Configure Docker's upstream APT repository] **************
changed: [machine1]

TASK [nickjj.docker : Install Docker] ******************************************
fatal: [machine1]: FAILED! => {"changed": false, "msg": "No package matching 'docker-ce' is available"}

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

I don't know what Vagrant box you're using, is it a 32bit of 64bit OS?

Also check this: #37 (comment) and read it until the end of the issue.

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

Closing this since it looks like you got past this based on your other issue without needing to modify anything in this role.

from ansible-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.