ansible / proposals

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

in the roles allow "<role-name>(-defaults/tasks/files/...).y(a)ml" as default file name instead of main.yml #188

Open gturbo opened 3 years ago

gturbo commented 3 years ago

Proposal: in the roles allow "(-defaults/tasks/files/...).y(a)ml" as default file name instead of main.yml

Author: GAEL <@gturbo> IRC: handle (if different)

Date: 2021-01-08

Motivation

Easier developper experience when working with mutliple rôles in IDE and ease finding files in file system

Problems

When you open multiple modules tasks / vars / ... in an IDE to build your plays. It's sometimes not very easy to have all files named "main.yml" wich is what you end up doing once you use the best practices and separate your plays in modular unitary roles.

Solution proposal

only the rules responsible for searching files when parsing roles and the galaxy template generator should be impacted

Dependencies (optional)

Testing (optional)

?

Documentation (optional)

?

Anything else?

If you'd like to add anything else beyond the above required and optional sections, you are welcome to do so.

gitqlt commented 3 years ago

According to the documentation:

By default Ansible will look in each directory within a role for a main.yml file for
relevant content (also main.yaml and main)

So a second option would help (in all three of the above forms: xyz.yml / xyz.yaml / xyz). It would be nice to have tasks/tasks.yml, handlers/handlers.yml, defaults/defaults.yml, vars/vars.yml, meta/meta.yml as options.

bcoca commented 3 years ago

main can also be a directory and you can name the files whatever you want under that