ansible / proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
Creative Commons Zero v1.0 Universal
93 stars 19 forks source link

'taskify' includes #136

Open bcoca opened 6 years ago

bcoca commented 6 years ago

Proposal: make include_X behave more like normal tasks

Author: Brian Coca <@bcoca> IRC: bcoca

Date: 2018-13-01

Motivation

make task lists are roles more reusable

Problems

Solution proposal

Implement a couple of new featuers to the include:

Dependencies

Testing

yes, normal integration tests should suffice

Documentation

in the modules affected

Problems

urusha commented 6 years ago

-removed-

bcoca commented 6 years ago

@urusha I'm not sure what you mean, those seem like unrelated issues.

urusha commented 6 years ago

Unrelated. Sorry, wrong tab :)

privateip commented 6 years ago

@bcoca does this proposal allow for defining the tasks entry point or does this only work with main.yml

bcoca commented 6 years ago

entry point should not matter, it would affect the role as a whole, but if we make it an option, it will let the user mix/match how he wants it to work in either case

updated proposal and example with 'simple_output'' to clarify my meaning

chouseknecht commented 6 years ago

@bcoca

Seems like a reasonable idea.

alikins commented 6 years ago

If we do this and the role arg spec stuff and contentpath with fully qualified names for roles, that would be really close to allowing:

hosts: myhosts
vars:
  some_var: some_value
  some_other_var: some_other_value
tasks:
   - name: some debug task
     debug:
       var: some_other_var

   # just a regular task
   - file:
        state: dir
        path: /dev/null/somepathwhatever

    # dont get hung up on this particular name format, just need some name/id that
    # identifies this as a role and a particular role. much like 'file:' means the file module
   - roles.mygithubuser.mycollection.myrole:
       some_role_var: blippy
       some_option: "{{some_other_var}}"
     register: the_result_of_myrole
bcoca commented 6 years ago

@alikins that was something i proposed in the past, a bit different as i was using @ to signify 'its a role':,

 - @rolname: 
         tasks_from: x
     vars:
        x: y

It is not something I'm currently aiming for, at this point i just want to take small steps that are useful by themselves but as a whole make roles a lot more reusable.

zakstar commented 5 years ago

Can we also have 'until' for include_X?

jamescassell commented 5 years ago

Can we also have 'until' for include_X?

I tend to use a recursive include when I need this functionality.

jean-christophe-manciot commented 1 year ago

@bcoca

Is this still in the works or abandoned?

bcoca commented 1 year ago

neither, its on wishlist, but no immediate plan

kunamashina commented 9 months ago

This is required, hopefully will be looked into and implemented next year