Hello Deepak,

You're not following the right syntax for a YML inventory. Check the following link:

https://docs.ansible.com/ansible/latest/plugins/inventory/yaml.html

I don't know what you're trying to do with the " 2022" string there. It's not valid yaml.

According to the docs in the link. You probably have to do something like this.

$ cat lala.yml
KafkaNonprodservers:
  hosts:
      abc.abc.com:
      abd.abd.com:
  vars:
      ansible_user: abc

You can always analyze your inventory file with ansible-inventory, like this:

$ ansible-inventory  -i lala.yml  --graph --vars
@all:
  |--@KafkaNonprodservers:
  |  |--abc.abc.com
  |  |--abd.abd.com
  |  |--{ansible_user = abc}
  |--@ungrouped:

Hope that helps,


Hugo


On 2/1/19 3:01 AM, Deepak Sharma 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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[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.
--

Hugo F. gonzalez

Senior Consultant

Red Hat LATAM <https://www.redhat.com>

<https://red.ht/sig>

--
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/a612ebf2-e9c3-0223-da6f-a924ebf1b755%40redhat.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to