Coder Social home page Coder Social logo

Comments (5)

drybjed avatar drybjed commented on June 14, 2024

This sounds like a neat idea. It could be implemented this way:

  • convert the daemon.json template so that the output is stored in a variable, if it's not done already
  • add a YAML dictionary variable in defaults for custom data structures included in the variable
  • in the template, merge the generated configuration with custom dictionary variable

Let me know if you want to try and implement this, if not I can look at it later on.

from ansible-docker.

Routhinator avatar Routhinator commented on June 14, 2024

So looking at this, I wasn't quite sure how to parse an array of unknown depth properly in Jinja, something I've not had to do yet. However adding the storage vars was quite simple to do as they were a known. I've forked and created a branch and am about to test it before submitting a pull request, which will add two vars; one for storage-driver and one for storage-options.

I'll circle back afterwards to see how I might handle the arbitrary config blocks, I imagine we'll need to determine max depth of the array to handle it properly? Not sure.

from ansible-docker.

drybjed avatar drybjed commented on June 14, 2024

You don't need to worry about arbitrary length. Assuming that the variable contents will be YAML-formatted, all you need to do in the template is to have:

{% set finished_var = (template_var | combine((inventory_var | from_yaml))) %}

That should do it.

from ansible-docker.

Routhinator avatar Routhinator commented on June 14, 2024

Hmm, ok.

Pull request #35 is in and passed my testing as working for the storage vars in the meantime.

from ansible-docker.

Routhinator avatar Routhinator commented on June 14, 2024

Pull #36 is in for the arbitrary options.

from ansible-docker.

Related Issues (17)

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.