Giter Club home page Giter Club logo

ansible-with-first's Introduction

Use case

I'd like to generate a bunch of /etc/bind9/zone.d/${zone_name}.zone files. These files ought either come from a _stock.zone template, or, if available, a ${zone_name}.zone file.

Status

At present this ansible-playbook with-first.pb gives ERROR: with_(plugin), and first_available_file are mutually incompatible in a single task. This result is in accord with ansible/ansible#552 , Make with_items and first_available_file usable together or otherwise warn, which this script attempts to do.

Hope

with_item and first_available_file both collide with the $item variable. Rather than forbid this clobbering outright, provide a non-colliding codepath where both can be used: with_{plugin} to iterate through the action multiple times, and first_available_file to look for targets within a single run. with-first.disambiguated.pb demonstrates such a non-colliding path, making use of distinct ${firstAvailableFile} and ${item} files.

For backwards compatibility sake, ${item} can continue to be set by first_available_file in all cases where with_{plugin} is not used.

Alas movement appears to be towards further overriding the use of ${item} to make it do more, not separate out the distinct contextual uses of first_available_file (which operates WITHIN an iteration of a module being looped through via with_{plugin}) and with_{plugin}, which triggers this outtermost looping iteration. ansible/ansible#2260

ansible-with-first's People

Contributors

rektide avatar

Watchers

 avatar  avatar  avatar

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.