> > > ################################### INVENTORY 
> > > # file: *inventory/oracle* 
> > > [oracle] 
> > > lx00011010d 
> > > 
> > > # file: *inventory/other* 
> > > [other] 
> > > lx00016141d 
> > > [...] 
> > > ################################### GROUP_VARS 

> *ansible-inventory --list --vars*
> [...]
>     "oracle": {
>         "hosts": [
>             "lx00016141d"
>         ]
>     },
>     "other": {
>         "hosts": [
>             "lx00011010d"
>         ]
>     }
> }

> [admin@lx00010300p ansible-help]$ ansible-config dump
> [...]
> DEFAULT_HOST_LIST(/sdd/ansible-help/ansible.cfg) = 
> [u'/sdd/ansible-production/inventory']

The problem might be DEFAULT_HOST_LIST. The doc says
DEFAULT_HOST_LIST: "Comma separated list of Ansible inventory sources"
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-host-list

Fix the configuration. For example in ansible.cfg

    [defaults]
    inventory = /sdd/ansible-production/inventory/oracle,
                /sdd/ansible-production/inventory/other

(note: ini_file doesn't handle multi-line entries #4413)
https://github.com/ansible/ansible-modules-core/issues/4413

If this does not help proceed with the simplified test below.

I had set this option also to *directory* "inventory", but this does not seem
to be a problem and I was not able to reproduce the behaviour where the groups
"oracle" and "other" swap the hosts.

    $ grep inventory ansible.cfg
    inventory = $PWD/inventory

    $ tree inventory/
    inventory/
    ├── oracle
    └── other

    $ cat inventory/oracle 
    [oracle]
    lx00011010d

    $ cat inventory/other 
    [other]
    lx00016141d

    $ tree group_vars
    group_vars
    ├── all.yml
    └── oracle.yml

    $ cat group_vars/all.yml 
    users:
      - username: jeff5

    $ cat group_vars/oracle.yml 
    users:
      - username: oracle

    $ ansible-inventory --list --var
    [...]
        "oracle": {
            "hosts": [
                "lx00011010d"
            ]
        }, 
        "other": {
            "hosts": [
                "lx00016141d"
            ]
        }

The goal is to explain why you see the groups "oracle" and "other" swapping
the hosts. Try to reproduce the simplified test above, step by step increase
the complexity of the use-case and isolate the problem.

Cheers,

        -vlado

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20191019154734.75679f2e%40gmail.com.

Attachment: pgpV9d9cUBDtt.pgp
Description: OpenPGP digital signature

Reply via email to