Hi, you just have to add “vars” to the group name, so assuming “computenodes” is your group you would have something like:
"computenodes": {
"hosts": [
"192.168.0.68"
],
“vars”:{
“var1”: “Var”,
“var2”: 2
}
}
Have a look here:
https://github.com/Shaps/mongo-dynamic-inventory/blob/master/inventory.py#L55
<https://github.com/Shaps/mongo-dynamic-inventory/blob/master/inventory.py#L55>
Andrea
> On 13 May 2015, at 07:17, Ritesh Shetty <[email protected]> wrote:
>
> Hi
> I have a requirement to run playbook on hyperv compute nodes (windows) i
> tried the method mentioned to keep all variables .
>
> ansible_ssh_user: Administrator
> ansible_ssh_pass: password
> ansible_ssh_port: 5986
> ansible_connection: winrm
>
>
> I use dynamic inventory to get the target hosts dynamically. Since the hosts
> are not static and they keep changing i cannot keep the above variables in a
> static file in group_vars
>
> Question is can group_vars be passed as part of the dynamic inventory json ?
> Can i have a section in _meta as group_vars ? if yes what would be the
> structure ?
>
> {
> "_meta": {
> "hostvars": {
> "192.168.0.68": {
> "username": "Administrator",
> "hypervisor_type": "hyperv",
> "hypervisor_id_list": [
> "2"
> ],
> "password": "password",
> "port": "5986"
> }
> }
> },
> "computenodes": {
> "hosts": [
> "192.168.0.68"
> ]
> }
> }
>
>
>
> --
> 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/54d59730-8f73-4402-b008-4fb7b4ee136e%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/54d59730-8f73-4402-b008-4fb7b4ee136e%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <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/B0F10099-8F03-4513-8081-1455221E0F29%40andreatartaglia.com.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail
