get facts from vsphere

[root@localhost ~]# cat  facts.yml
---
- hosts: localhost       
  tasks:
    - name: get all registered vms
      vmware_vm_facts:
        hostname: 192.168.0.108
        username: root 
        password: vgskiran 
        validate_certs: False 
      register: vmfacts
    - name: print facts
      debug:
        msg: "{{vmfacts}}"



root@localhost ~]# ansible-playbook facts.yml

PLAY [localhost] *************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************
ok: [localhost]

TASK [get all registered vms] ************************************************************************************************************************
ok: [localhost]

TASK [print facts] ***********************************************************************************************************************************
ok: [localhost] => {
    "msg": {
        "changed": false,
        "failed": false,
        "virtual_machines": {
            "1cpu": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213e8ab-45a0-dedc-6029-979fc9cdddd2"
            },
            "2cpu": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213adca-cfe0-0f8e-66d6-0cdcad386e8c"
            },
            "c": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213f291-5c6c-4f71-69b9-6006508603f0"
            },
            "cento": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [
                    "00:50:56:93:0f:66"
                ],
                "power_state": "poweredOff",
                "uuid": "4213b043-04ca-ca0b-02db-dac960b3842a"
            },
            "centos-server-6.4-x86_64": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [
                    "00:0c:29:91:d7:da"
                ],
                "power_state": "poweredOff",
                "uuid": "564d97cb-9bef-97cc-b6ee-0e068391d7da"
            },
            "cpu": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213c7b9-bc1b-979d-21a9-2e9524783468"
            },
            "suma": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [
                    "00:50:56:93:d3:1a"
                ],
                "power_state": "poweredOff",
                "uuid": "42136249-e46f-a694-610f-7c8fc866d093"
            },
            "temp": {
                "guest_fullname": "Debian GNU/Linux 6 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "42135f3f-cbb3-98d0-ca5f-56b7f77ac21e"
            },
            "temp1": {
                "guest_fullname": "Debian GNU/Linux 6 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213942e-7a75-0bca-4daf-5332cf11c870"
            },
            "temp2": {
                "guest_fullname": "Debian GNU/Linux 6 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213c1d3-634a-9e49-8069-a174aa2d7de2"
            },
            "tempt": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "42132ec4-7e52-3692-2e1f-a5b6d1954f93"
            },
            "tempt1": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "42138d40-ff82-4f2d-ab0f-ae43f0a2c542"
            },
            "tempt2": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "421332df-30bf-5e3a-5247-10e138b2620d"
            },
            "tempt3": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "421371a3-693b-9661-181c-858a1d95a9d2"
            },
            "test": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [],
                "power_state": "poweredOff",
                "uuid": "4213087e-8a36-1e4a-18c9-27e70f984fd4"
            },
            "testvm": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [
                    "00:50:56:93:39:02"
                ],
                "power_state": "poweredOff",
                "uuid": "42131f67-4856-891c-6d22-f2489d9d181e"
            },
            "testvm_2": {
                "guest_fullname": "CentOS 4/5/6/7 (64-bit)",
                "ip_address": "",
                "mac_address": [
                    "00:50:56:93:3a:b6"
                ],
                "power_state": "poweredOff",
                "uuid": "4213493f-88b4-7139-997b-ba706e05e0c2"
            }
        }
    }
}

PLAY RECAP *******************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0 

[root@localhost ~]#

Comments