Closed RomainMou closed 10 months ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the component bot command.
Also, if the fact is not already define, role parameter still works as expected:
---
- name: Test
hosts: localhost
gather_facts: false
become: false
roles:
- role: test_debug
test_set_one: "Set as role parameter"
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [Test] *********************************************************************************************************************************************************************************************************
TASK [test_debug : Debug the variable.] *****************************************************************************************************************************************************************************
ok: [localhost] => {
"test_set_one": "Set as role parameter"
}
PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Bisected to 0b678d5036f64f95d50d73d3d27a523a2b264050
I could call this as a braking change. We rolled back to previous ansible version because of this bug. It can cause huge issues when working with multiple roles on production. Is there any roadmap for this?
we don't do roadmap for bugs, but this is on my list to solve, I had to clear out a few other bugs with roles first, this quite high up the queue now.
Summary
Hi ;
Since Ansible 8.0.0 (I think, I didn't check every ansible-core version), it seams that role parameters do not take precedence over already define facts.
According to the documentation, role (and include_role) params (line 20) should still take precedence over set_facts / registered vars (line 19). I also checked Ansible 8.x changelogs but I didn't see anything about that, except maybe this bug fix, I'm not sure what
Also adjusted the precedence to act the same as inline params
means and what are the expected impacts. But if this is a wanted new behavior, I feal like it should be details in major changes, not in the bug fix section.Issue Type
Bug Report
Component Name
role
Ansible Version
Configuration
OS / Environment
Tested on Archlinux and also in python:3.11 docker container.
Steps to Reproduce
Create
roles/test_set/tasks/main.yml
with:Create
roles/test_debug/tasks/main.yml
with:Create
test.yml
with:Run:
ansible-playbook test.yml
.Expected Results
This is a the result with ansible 7.x, here the corresponding version used to obtain it:
Actual Results