Closed Incubatio closed 6 years ago
I found this very unintuitive.
Agreed. Too many such inconsistencies with Ansible's interface.
Unintuitive, yes. I was recently bitten by a similar issue. However, it makes sense once you see how "hostvars" is laid out, host vars don't seem to be linked in any way to the groups on which they are defined. The documentation should make this point clearer.
I found this very unintuitive.
Must agree too! Reading the docs doesn't say a word about this and, for exemple, managing multiple instance of apache configuration make this behaviour very confusing and counter intuitive. If your using a --limit clause, you expect that the variable define in THAT groups_vars get picked up., NOT the other groups just because it's the same host!?
@Incubatio Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.
Here are the items we could not find in your description:
Please set the description of this issue with this template: https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md
@Incubatio You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information.
bot_broken
i'm not sure what is the component name (if there is one related to it). Is there a component list somewhere that i could check ?
Issue Type: Feature and/or Bug Report
Ansible Version: ansible 1.9.3
Summary: In a host file, when defining two distinct groups pointing to the same ip, configuration get merged. I found this very unintuitive. However, when defining two groups pointing to two domain that point to the same ip group_vars and host vars will work as expected.
How to reproduce: https://github.com/Incubatio/ansible_variable_tests
Story: I'm a new ansible user. First docs tells us to define a group. Then docs tells us we can define group of groups. Then docs tells us we can define specific config for host and group.
My first personal conclusion was: "ok, a group is an entity for one or more hosts, so defining a group is like defining a virtual environment with the possibility to store variable inside it"
If I use ip address like this:
the previous conclusion is incorrect, and db_port value will be 2222 regardless of the actual target group i'm deploying to.
If I use domain instead of ip like this:
the previous conclusion is correct, and db_port value will be defined according to the group i'm deploying to.
EDIT: Sorry for the first post, it was long, poorly written and partly incorrect.