Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 1317934[details]
Replication playbook example
Description of problem:
The include_vars module is too high on the variable precedence list as documented here: http://docs.ansible.com/ansible/latest/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable and significantly prevents user customization. Users are unable to define variables for the role at the top level playbook and can only overwrite with extra vars or facts.
Version-Release number of selected component (if applicable):
7.4
How reproducible:
Top level playbook which calls the network role attached.
Steps to Reproduce:
1. `ansible-playbook -i some_inventory network-var.yml -e nodes="some_group_or_host"`
Actual results:
At the role "tasks" level, the following task overwrites "something_else" for network_provider
```
- name: Set version specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
```
Expected results:
"something_else" is retained
Additional info:
This is important for network role users on RHEL7 who are still using initscripts over NetworkManager. The only way around this requires custom modification of the role and should be more accessible.
I can't really reproduce your problem with network_provider. If I set it to "something_else", the role complains that "unsupported provider something_else". IMO this is correct. Yes, include_vars module is high on the variable precedence list, but the files included this way do not actually define "network_provider" and therefore they do not clobber it. It clobbers network_provider_default and network_packages, but I suppose those are not intended to be customized by the user.
To debug such issues, I suggest importing the role using tasks:include_role: instead of roles: and use the debug module before and after. You should see that the network role changes network_provider_default but not network_provider.
tasks:
- name: debug var before
debug:
var: network_provider
- name: net role
include_role:
name: linux-system-roles.network
ignore_errors: True
- name: debug var after
debug:
var: network_provider
the files in vars [1] do not define "network_provider" at all. Hence, the original comment is incorrect:
> At the role "tasks" level, the following task overwrites "something_else" for
> network_provider
Which can also be seen with -vvvv:
fatal: [test-server]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"connections": [
...
"ignore_errors": "False",
"provider": "initscripts"
}
},
What however happens is that other variables like network_service_name and network_packages are overwritten. Which is wrong and needs fixing
[1] https://github.com/linux-system-roles/network/tree/a4ebfadded1c4e96e3a7b5e71f7cfc2da46ee1d6/vars
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2017:2970