Ansible gather facts

22 views
Skip to first unread message

Fahad Riaz

unread,
Mar 8, 2019, 10:50:58 AM3/8/19
to ansible...@googlegroups.com

Hi All, 
I wrote the following playbook to gather facts about a particular datastore from vsphere. 
the playbook worked, however I had to add -vvv flag to see the facts.

2 questions
1- is there a file that gets the output of the playbook
2- the facts are shown in bytes, is there a way to see the facts in GB.


  - name: gather facts from datacenter about datastore
    vmware_datastore_facts:
      hostname: DC-VCSA2
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      datacenter:  Datacenter
      name: datastore1
      validate_certs: false
    delegate_to: localhost
    register: facts

--
Best,
Fahad Riaz

Kai Stian Olstad

unread,
Mar 8, 2019, 11:25:53 AM3/8/19
to ansible...@googlegroups.com
On 08.03.2019 16:50, Fahad Riaz wrote:
> Hi All,
> I wrote the following playbook to gather facts about a particular datastore
> from vsphere.
> the playbook worked, however I had to add -vvv flag to see the facts.
>
> 2 questions
> 1- is there a file that gets the output of the playbook

Sort of, you can set log_path
https://github.com/ansible/ansible/blob/0e9a79a5893357b156de98c0cb07039b11f15b71/examples/ansible.cfg#L111

> 2- the facts are shown in bytes, is there a way to see the facts in GB.

No, not without changing the code.


> - name: gather facts from datacenter about datastore
> vmware_datastore_facts:
> hostname: DC-VCSA2
> username: "{{ vcenter_username }}"
> password: "{{ vcenter_password }}"
> datacenter: Datacenter
> name: datastore1
> validate_certs: false
> delegate_to: localhost
> register: facts

To see the content of fact variable just add this task

- debug: var=facts


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages