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

Registered variables can clear out hostvars #8968

Closed
mpeters opened this issue Sep 10, 2014 · 1 comment
Closed

Registered variables can clear out hostvars #8968

mpeters opened this issue Sep 10, 2014 · 1 comment
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed

Comments

@mpeters
Copy link
Contributor

mpeters commented Sep 10, 2014

Issue Type:

Bug Report

Ansible Version:

ansible 1.8 (devel 239b6e7) last updated 2014/09/10 21:18:25 (GMT +000)

Environment:

CentOS 6.5

Summary:

After commit 10afaee when you register a variable from a task it can remove other hostvars.

Steps To Reproduce:

Run ansible-playbook with a play like this:

- hosts: all[0]
  gather_facts: true
  remote_user: sg
  tasks:
  - debug: var=hostvars[groups.all[0]].ansible_default_ipv4.address
  - command: ls /tmp
    register: foo
  - debug: var=hostvars[groups.all[0]].ansible_default_ipv4.address

It tries to debug the same variable (just the default ip address) both before and after running a simple ls /tmp command and registering the results.

Expected Results:

It should print the same output for both debug tasks.

Actual Results:

You get results like this:

PLAY [all[0]] ***************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [ec2-54-167-185-191.compute-1.amazonaws.com]

TASK: [debug var=hostvars[groups.all[0]].ansible_default_ipv4.address] ******** 
ok: [ec2-54-167-185-191.compute-1.amazonaws.com] => {
    "hostvars[groups.all[0]].ansible_default_ipv4.address": "10.101.201.36"
}

TASK: [command ls /tmp] ******************************************************* 
changed: [ec2-54-167-185-191.compute-1.amazonaws.com]

TASK: [debug var=hostvars[groups.all[0]].ansible_default_ipv4.address] ******** 
ok: [ec2-54-167-185-191.compute-1.amazonaws.com] => {
    "hostvars[groups.all[0]].ansible_default_ipv4.address": "{{ hostvars[groups.all[0]].ansible_default_ipv4.address }}"
}

PLAY RECAP ******************************************************************** 
ec2-54-167-185-191.compute-1.amazonaws.com : ok=4    changed=1    unreachable=0    failed=0
mpeters referenced this issue Sep 10, 2014
The vars_cache was not being properly merged with the setup_cache
for all hosts, which was previously not noticed when registered
variables were stored in the setup_cache.

Fixes #8944
@jimi-c jimi-c added P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed bug_report labels Sep 10, 2014
@jimi-c jimi-c closed this as completed in dacb6b8 Sep 10, 2014
@jimi-c
Copy link
Member

jimi-c commented Sep 10, 2014

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Projects
None yet
Development

No branches or pull requests

3 participants