Thanks Keif,

I have added vars as port and users, after that it is working fine.

Regards,
Deepak

On Fri, Feb 1, 2019 at 5:12 PM Keif Gwinn <[email protected]> wrote:

> sorry got the wrong idea, I'm also new to ansible.
>
> The variables you're adding need to go under a vars section
>
> KafkaNonprodservers:
>   hosts:
>       - abc.abc.com:2022
>       - abd.abd.com:2022
>   vars:
>     ansible_user: abc
>
> [keif@ansible-lab ansible]$ ansible-inventory -i keif/test.yml --list
> {
>     "KafkaNonprodservers": {
>         "hosts": [
>             "abc.abc.com:2022 abd.abd.com:2022"
>         ]
>     },
>     "_meta": {
>         "hostvars": {
>             "abc.abc.com:2022 abd.abd.com:2022": {
>                 "ansible_user": "abc"
>             }
>         }
>     },
>     "all": {
>         "children": [
>             "KafkaNonprodservers",
>             "ungrouped"
>         ]
>     },
>     "ungrouped": {}
> }
>
>
> On Fri, 1 Feb 2019 at 12:34, Keif Gwinn <[email protected]> wrote:
>
>> Hi Deepak,
>>
>> ansible_user is a special variable used by ansible for ssh, part of the
>> main config. If you use a different variable name in your config file you
>> should be fine.
>>
>>
>> https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#list-of-behavioral-inventory-parameters
>>
>> On Fri, 1 Feb 2019 at 09:01, Deepak Sharma <[email protected]> wrote:
>>
>>>
>>> Hi Everyone,
>>>
>>> I am new to Ansible , I have created new inventory yml file with below
>>> details .
>>>
>>> KafkaNonprodservers:
>>>   hosts:
>>>       abc.abc.com:2022
>>>       abd.abd.com:2022
>>>    ansible_user : abc
>>>
>>> but I am getting below error
>>>
>>> + ansible-inventory -i ./ansible/Hosts.yml --list [WARNING]: Skipping
>>> unexpected key (ansible_user) in group (KafkaNonprodservers), only "vars",
>>> "children" and "hosts" are valid
>>> {
>>>
>>> Can you please guide me,.
>>>
>>> Regards,
>>> Deepak
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/fb100f1b-3641-4267-8e35-e187c341631a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/fb100f1b-3641-4267-8e35-e187c341631a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Keif Gwinn
>>
>
>
> --
> Keif Gwinn
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAMTXzjUunWUjVS7HkAs4Yov_gj%3DJPQrUHDCEpq%2BuOcZ0p%3DFAtw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAMTXzjUunWUjVS7HkAs4Yov_gj%3DJPQrUHDCEpq%2BuOcZ0p%3DFAtw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BCJ-ubLLY8r_OZYD2HwBipwcPcZtVQG1Yo-HfukaPUkEv6w5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to