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

group vars of other hosts don't appear in hostvars #75599

Closed
1 task done
jeee opened this issue Aug 30, 2021 · 9 comments
Closed
1 task done

group vars of other hosts don't appear in hostvars #75599

jeee opened this issue Aug 30, 2021 · 9 comments
Labels
affects_2.12 bug This issue/PR relates to a bug. inventory Inventory category support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@jeee
Copy link

jeee commented Aug 30, 2021

Summary

A playbook which used to work fine stopped working. I am using the 'hash_behaviour = merge' option in ansible.cfg. The group variables of other hosts don't appear in hostvars anymore.

Issue Type

Bug Report

Component Name

inventory

Ansible Version

ansible [core 2.11.1] 
  config file = /etc/ansible/ansible.cfg
  python version = 3.8.10 (default, Jun  2 2021, 10:49:15) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

Configuration

ansible-config dump --only-changed

OS / Environment

Ubuntu 20.04

Steps to Reproduce

  children:
  
    group:
      hosts:
        hostA:
          configx:
            var1: 11111
        hostB:
          configx:
            var1: 22222
          
      vars:
        configx:
          var2: 33333
- hosts: all
  become: yes
  vars:
    
  tasks:
  - name: Show HostVarsVars object
    debug:
      var: hostvars

Expected Results

            "configx": {
                "var1": 22222
                "var2": 33333
            },```

### Actual Results

```console
"hostB": {
            "configx": {
                "var1": 22222
            },

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Aug 30, 2021

Files identified in the description:

  • lib/ansible/inventory

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.12 bug This issue/PR relates to a bug. inventory Inventory category needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 30, 2021
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Aug 31, 2021
@mkrizek
Copy link
Contributor

mkrizek commented Aug 31, 2021

Can you give us the output of ansible-config dump --only-changed?

needs_info

@ansibot ansibot added the needs_info This issue requires further information. Please answer any outstanding questions. label Aug 31, 2021
@ansibot
Copy link
Contributor

ansibot commented Oct 2, 2021

@jeee This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

@jeee
Copy link
Author

jeee commented Oct 2, 2021

Can you give us the output of ansible-config dump --only-changed?

needs_info

This command gives no output.

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Oct 2, 2021
@mkrizek
Copy link
Contributor

mkrizek commented Oct 4, 2021

Can you give us the output of ansible-config dump --only-changed?
needs_info

This command gives no output.

Which is in contradiction with the statement in the issue description that says I am using the 'hash_behaviour = merge' option in ansible.cfg..

Since the command gives no output hash_behavior=replace is used because it is the default and as such the output in Actual Results is expected.

If you have further questions please stop by IRC or the mailing list:

@mkrizek mkrizek closed this as completed Oct 4, 2021
@jeee
Copy link
Author

jeee commented Oct 4, 2021

$ cat /etc/ansible/ansible.cfg |grep merge
hash_behaviour = merge

@jeee
Copy link
Author

jeee commented Oct 4, 2021

looks like at least ansible-config is not using the config anymore?
$ ansible-config dump |grep -i hash
DEFAULT_HASH_BEHAVIOUR(default) = replace

@jeee
Copy link
Author

jeee commented Oct 4, 2021

strange. 'ansible-config view' shows hash_behaviour = merge at the end.

@jeee
Copy link
Author

jeee commented Oct 4, 2021

looks like it was in the wrong section in the config file. Don't understand what happened exactly cause it worked before. Sorry for the trouble.

@ansible ansible locked and limited conversation to collaborators Nov 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.12 bug This issue/PR relates to a bug. inventory Inventory category support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

3 participants