Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying file information for include_tasks when using the ansible-playbook command with the --list-tasks option #83181

Open
1 task done
chungeun-choi opened this issue May 2, 2024 · 5 comments
Labels
feature This issue/PR relates to a feature request.

Comments

@chungeun-choi
Copy link

Summary

When running the ansible-playbook command with the --list-tasks option, if tasks are referenced using include_tasks and lack a name value, the output is as shown below (AS-IS). I find this output format to be less visible. It would be better if the names of the referenced files were also displayed.

Issue Type

Feature Idea

Component Name

taskmsg

Additional Information

[AS-IS]

  play #8 (test): test	TAGS: []
    tasks:
      include_tasks	TAGS: [test]
      include_tasks	TAGS: [test]
      include_tasks	TAGS: [test]

[TO-BE]

  play #8 (test): test	TAGS: []
    tasks:
      include_tasks INCLUDE: test1.yml	TAGS: [test]
      include_tasks INCLUDE: test2.yml	TAGS: [test]
      include_tasks INCLUDE: test3.yml	TAGS: [test]

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented May 2, 2024

Files identified in the description:

None

If these files are incorrect, please update the component name section of the description or use the component bot command.

@ansibot ansibot added feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. labels May 2, 2024
@bcoca
Copy link
Member

bcoca commented May 2, 2024

the problem with this:

- include_tasks:
          name: '{{variable}}.yml'

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label May 2, 2024
@chungeun-choi
Copy link
Author

the problem with this:


- include_tasks:

          name: '{{variable}}.yml'

If I do as you suggested, it does produce the output I want, but wouldn't it be more visible if the output could be shown even without the ansible author entering the name value?

@bcoca
Copy link
Member

bcoca commented May 3, 2024

I was not clear enough, I was posting the case in which the play did not have that variable defined, if it comes from inventory or extra vars or runtime composition in other ways, it won't be available for templating so you cannot show which file, much less which tasks it would include.

@chungeun-choi
Copy link
Author

I was only referring to the part about the file that import_task refers to. Does it also retrieve the name of the file referenced by import_task at runtime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants