here is my config

plugin: vmware_vm_inventory
strict: False
hostname: {{ vcenter_host }}.{{ domain_name }}
username: {{ vcenter_user }}
password: {{ vcenter_password }}
validate_certs: False
with_tags: True
ansible_python_interpreter: /tmp/vminv_virtualenv/bin/python


I run 
python $(which ansible-inventory) --list -i ./{{ vcenter_host }}.{{ 
inventory_yaml }} --vault-password-file={{ password_file }}  -y > ../{{ 
inventory_directory }}/hosts.{{ vcenter_host }}.ymlansible-inventory -i 
<config.yml> -y


here is what I get:



all:
  children:
    Application: {}
    CFG: {}
    DEMO: {}
    DEV:
      hosts:
        *********:
          ansible_host: *********
          config.cpuHotAddEnabled: false
          config.cpuHotRemoveEnabled: false
          config.hardware.numCPU: 4
          config.instanceUuid: 5026aa79-6b5e-8310-46be-850498deb8a4
          config.name: *********
          config.template: false
          guest.guestId: windows8Server64Guest
          guest.guestState: running
          guest.hostName: *********
          guest.ipAddress: *********
          name: *********
          runtime.maxMemoryUsage: 16384
        *********:
          ansible_host: *********
          config.cpuHotAddEnabled: false
          config.cpuHotRemoveEnabled: false
          config.hardware.numCPU: 4
          config.instanceUuid: 50265e22-8599-48cf-c6ed-3f060416f733
          config.name: *********
          config.template: false
          guest.guestId: windows8Server64Guest
          guest.guestState: running
          guest.hostName: *********
          guest.ipAddress: *********
          name: *********
          runtime.maxMemoryUsage: 16384
        
....

 poweredOff:  <want to exclude>
      hosts:
        20100608p_ws2k8ex64sp2:
          config.cpuHotAddEnabled: false
          config.cpuHotRemoveEnabled: false
          config.hardware.numCPU: 1
          config.instanceUuid: 5014d83b-9acb-1c2a-b830-1e78080ce71c
          config.name: 20100608p_WS2K8Ex64SP2
          config.template: false
          guest.guestId: null
          guest.guestState: notRunning
          guest.hostName: null
          guest.ipAddress: null
          name: 20100608p_WS2K8Ex64SP2
          runtime.maxMemoryUsage: null
        20150928-w2k12r2:
          config.cpuHotAddEnabled: true
          config.cpuHotRemoveEnabled: false
          config.hardware.numCPU: 2
          config.instanceUuid: 5288e531-2433-c90a-f922-d5b956ebb018
          config.name: 20150928-w2k12r2
          config.template: false
          guest.guestId: null
          guest.guestState: notRunning
          guest.hostName: WIN-PJKUVJ4HV62
          guest.ipAddress: null
          name: 20150928-w2k12r2
          runtime.maxMemoryUsage: null

On Wednesday, June 24, 2020 at 9:42:34 AM UTC-7, Abhijeet Kasurde wrote:
>
> Could you please share your inventory plugin config?  What you want to 
> achieve with small example?
>
> On Wed, Jun 24, 2020 at 9:58 PM Todd Schaal <[email protected] 
> <javascript:>> wrote:
>
>> I have the vmware_vm_inventory plugin working.  My issue is that it 
>> returns everything, including powered-off vms.  I can filter them out when 
>> I run my playbooks,  but I'd prefer they not be in my inventory in the 
>> first place.  Is there an easy way to accomplish this?
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/a4cde871-5ace-4fe9-b966-d2db66e44709o%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/a4cde871-5ace-4fe9-b966-d2db66e44709o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Thanks,
> Abhijeet Kasurde
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8e65d452-d5be-491c-8e3a-ab056ee34abdo%40googlegroups.com.

Reply via email to