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
Make role 'parameters' formally have pure function parameter scope #47606
Labels
affects_2.15
feature
This issue/PR relates to a feature request.
has_pr
This issue has an associated PR.
include_role
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
Comments
Hi @torched99, thank you for submitting this issue! |
Files identified in the description:
If these files are inaccurate, please update the |
ansibot
added
affects_2.8
This issue/PR affects Ansible v2.8
feature
This issue/PR relates to a feature request.
include_role
module
This issue/PR relates to a module.
needs_maintainer
Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml)
needs_triage
Needs a first human triage before being processed.
net_tools
Net-tools category
support:community
This issue/PR relates to code supported by the Ansible community.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
labels
Oct 25, 2018
jborean93
removed
module
This issue/PR relates to a module.
needs_maintainer
Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml)
needs_triage
Needs a first human triage before being processed.
net_tools
Net-tools category
support:community
This issue/PR relates to code supported by the Ansible community.
labels
Oct 26, 2018
cc @alikins |
ansibot
added
needs_maintainer
Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml)
support:community
This issue/PR relates to code supported by the Ansible community.
labels
Oct 26, 2018
ansibot
removed
the
needs_maintainer
Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml)
label
Nov 11, 2018
Files identified in the description: If these files are inaccurate, please update the |
ansibot
removed
the
support:community
This issue/PR relates to code supported by the Ansible community.
label
Feb 17, 2019
Fixed by #69040 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
affects_2.15
feature
This issue/PR relates to a feature request.
has_pr
This issue has an associated PR.
include_role
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
SUMMARY
Currently 'parameters' for roles are mentioned in the documentation, but are not effectively anything more than normal ansible variables, subject to the now very complex and confusing ansible scoping rules. For the use case where we create a re-usable role that is designed to behave in a similar manner as an ansible task module, there will be a bunch of variables that form the parameters (or arguments) of the role - some of which may be optional etc, and should ideally pick up defaults from the role's vars/main.yml or defaults/main.yml or simply remain undefined for conditional logic. At present to achieve this behaviour can be done in an unsatisfactory manner by:
<param_name>:- p__<role_name>__<param_name>
which makes for horribly long and ugly parameter passing yaml
What would be much cleaner and would help with scope issues in general would be to flag certain role variables as parameters, so that their values then ONLY be set from the call to 'include' the role, or from within the role action itself. In other words the similar behaviour as stack based standard function arguments in C for example. Then we can use simple (potentially common) short names, e.g. owner, group, mode, hostname, file, src, dest, etc for these parameter variable names and not worry about scope leakage.
ISSUE TYPE
COMPONENT NAME
roles
ADDITIONAL INFORMATION
Example illustrating proposed via hypothetical params keyword in meta/main.yml.
The text was updated successfully, but these errors were encountered: