Bug 2109263
| Summary: | Using set_fact with delegate_to and delegate_facts; true creates unpredicatable results | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Dimitri Savineau <dsavinea> |
| Component: | ansible-core | Assignee: | Dimitri Savineau <dsavinea> |
| Status: | CLOSED ERRATA | QA Contact: | Matt Clay <mclay> |
| Severity: | urgent | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.6 | CC: | jwboyer, toneata |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | ansible-core-2.12.2-4.el8_6 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-07-26 15:06:38 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Dimitri Savineau
2022-07-20 19:38:17 UTC
(In reply to Dimitri Savineau from comment #0) > This bug was initially created as a copy of Bug #2108651 > > I am copying this bug because: > > > > Original description found here: > https://bugzilla.redhat.com/show_bug.cgi?id=2107914#c12 > > ansible-core.x86_64 2.12.2-1.el9 > > Against an OpenStack deployment we run a simple playbook: > > - hosts: localhost > vars: > some_data: [ 'hey', 'ho', 'lets go'] > hoststo: ['controller-0', 'controller-1', 'controller-2'] > tasks: > - name: try this > set_fact: > well_this: "{{ item.1 }}" > delegate_to: "{{ item.0 }}" > delegate_facts: true > loop: "{{ hoststo|zip(some_data)|list }}" > > - debug: > msg: "{{ hostvars[item].well_this }}" > loop: "{{ hoststo }}" > > - name: try this again > set_fact: > well_this: "{{ item.1 }}" > delegate_to: "{{ item.0 }}" > delegate_facts: true > loop: "{{ hoststo|zip(some_data)|list }}" > > - debug: > msg: "{{ hostvars[item].well_this }}" > loop: "{{ hoststo }}" > > The result is: > > ok: [localhost -> controller-0(192.168.24.50)] => (item=['controller-0', > 'hey']) => { > "ansible_facts": { > "well_this": "hey" > }, > "ansible_loop_var": "item", > "changed": false, > "item": [ > "controller-0", > "hey" > ] > } > ok: [localhost -> controller-1(192.168.24.35)] => (item=['controller-1', > 'ho']) => { > "ansible_facts": { > "well_this": "ho" > }, > "ansible_loop_var": "item", > "changed": false, > "item": [ > "controller-1", > "ho" > ] > } > ok: [localhost -> controller-2(192.168.24.48)] => (item=['controller-2', > 'lets go']) => { > "ansible_facts": { > "well_this": "lets go" > }, > "ansible_loop_var": "item", > "changed": false, > "item": [ > "controller-2", > "lets go" > ] > } > > TASK [debug] > ***************************************************************************** > ***************************************************** > task path: /home/stack/hunh.yaml:13 > ok: [localhost] => (item=controller-0) => { > "msg": "lets go" > } > ok: [localhost] => (item=controller-1) => { > "msg": "ho" > } > ok: [localhost] => (item=controller-2) => { > "msg": "lets go" > } > > > The controller-0 fact has the value 'lets go' instead of 'hey'. As indicated > in the above link it seems pretty specific to this version of ansible-core. Hello Dimitri, You didn't follow the zstream process. This is an illegal zstream BZ. A zstream BZ is cloned from a Y stream BZ.It's not allowed to create directly zstream BZ https://docs.google.com/document/d/1yL8iTHjxyQ7sI-fC4PcPjpOOyfF5ECGnK-B7r_QRZm4/edit I'm blocking this advisory for release. 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 (ansible-core bug fix and enhancement update), 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-2022:5715 |