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

various issues with YAML hosts and multiple groups #395

Closed
atomatt opened this issue May 15, 2012 · 8 comments
Closed

various issues with YAML hosts and multiple groups #395

atomatt opened this issue May 15, 2012 · 8 comments

Comments

@atomatt
Copy link
Contributor

atomatt commented May 15, 2012

Ansible: devel, r404c3acbbf5ed3f2f6a5a2f64cc230cd22317e15
OS: Ubuntu 12.04
Python: 2.7.3

When a host is listed both "globally" and within a group, e.g.

10.0.3.232 foo=bar

[example]
10.0.3.232

[example:vars]
domain=example.com

The 'setup' command lists it only as belonging to "ungrouped" and ignores any group vars:

        "foo": "bar", 
        "group_names": "[ungrouped]", 
        "inventory_hostname": "10.0.3.232", 
@mpdehaan
Copy link
Contributor

If a host is in multiple groups, the groups list does not seem to contain all groups. It may be all in the groups still, just that the variable is not updated.

Do not know if this also occurs in the JSON version, testing welcome.

@rylach
Copy link

rylach commented May 16, 2012

See the following ansible-hosts:

[qa-db-hosts]
esiqadb99
esiqagw98

[qa1-hosts]
esiqagw98

esiqagw98 has in setup"

"group_names": [
    "qa-db-hosts"
], 

it seems, that only its first group has been set.

Cheers,

R.

@rylach
Copy link

rylach commented May 16, 2012

Also, the template

{% if 'qa-db-hosts' in groups %}
a.b.c.d some-internal-host
{% else %}
x.y.z.v some-other-internal-host
{% endif %}

expands for esiqagw98 to

x.y.z.v some-other-internal-host

so, it seems there is some other problem with {% if 'aaa' in groups %}, not only determining complete list of groups for host.

@mpdehaan
Copy link
Contributor

Yes, this is a known issue with hosts in multiple groups with the INI format. If someone wants to look into fixing it, that will be great and allow us to get 0.4 out sooner.

I'm not aware of any other major issues blocking things.

On Wednesday, May 16, 2012 at 7:55 AM, rylach wrote:

Also, the template

{% if 'qa-db-hosts' in groups %}
a.b.c.d some-internal-host
{% else %}
x.y.z.v some-other-internal-host
{% endif %}

expands for esiqagw98 to

x.y.z.v some-other-internal-host

so, it seems there is some other problem with {% if 'aaa' in groups %}, not only determining complete list of groups for host.


Reply to this email directly or view it on GitHub:
#395 (comment)

@rylach
Copy link

rylach commented May 18, 2012

Another related issue: when you add a host to INI file more then once, you have to define every time all its variables, e.g.:

[groupA]
hostA

[groupAB]
hostA varA=A

if you use groupAB in playbook - you won't see 'varA'; you have to define it in group A or switch order of groups.

Do you agree, that it should be also fixed?

@mpdehaan
Copy link
Contributor

yes

@mpdehaan
Copy link
Contributor

fixed on devel, let me know if this works for you or not, unit tests are updated and seems good to me.

@atomatt
Copy link
Contributor Author

atomatt commented May 19, 2012

Was just working on this myself and came up with almost the same change. Looks good to me.

@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants