ansible-cmdb icon indicating copy to clipboard operation
ansible-cmdb copied to clipboard

for windows servers some columns are blank

Open fmontaldo opened this issue 6 years ago • 8 comments

Hi,

This tool is amazing. I got some windows servers in my ansible inventory. When I check the html report the follwing columns are in black:

Disk Usage PhysDisk size

Also the Virt column show me this:

?/?

There is a way to fix it.

Thanks in advance

Federico

fmontaldo avatar Mar 14 '19 20:03 fmontaldo

Hi Federico!

I'm not sure if ansible collects the required facts for those columns on windows. I currently don't have access to any Windows hosts with Ansible. Can you send me an example output of the facts for windows (out/some.windows.host) at [email protected] so I can have a look at whether it has the necessary information?

fboender avatar Mar 15 '19 07:03 fboender

thansks for your replly I just sent you an email

fmontaldo avatar Mar 15 '19 13:03 fmontaldo

Hi Ferry,

Please let me know if you have an update on thins. I got a playbook example that extracts some data.

Thanks in advance

Federico

fmontaldo avatar Mar 24 '19 22:03 fmontaldo

Maybe use https://docs.ansible.com/ansible/latest/modules/win_disk_facts_module.html for show disk info?

orlovds avatar May 16 '19 06:05 orlovds

Hi, I have almost exclusive windows environment and also would like to have filled all columns in output. I created small powershell script which is readable by ansible

disk_info.ps1.txt

it is visible in this snippet:


"ansible_disk_info": { "Capacity": "50.00", "DeviceID": "C:", "DriveType": 3, "FreeSpaceGB": "30.35", "VolumeName": ""},

I attached whole generated file from windows machine

windows-host.json.txt

is it possible to add support for win machines into cmdb?

Thanks & Best Regards Peter

systemfifteen avatar Aug 01 '19 10:08 systemfifteen

Hi systemfifteen,

The windows-host.json.txt doesn't look like valid JSON. A few values are not quoted. For example

"ansible_domain": domain.com,

If you can manage to fix those problems, I believe you should be able to use these files with ansible-cmdb fairly straight forward. Normally you'd run ansible -m setup --tree out/ all and you'd get a directory of files that look almost the same as your windows-host.json.txt. So if you just manage to get those files in similar directory, where each file is named like the host it belongs too, it should work. Sometime like:

out/
  win01.mydomain.com

Where win01.mydomain.com has the contents of the windows-host.json.txt file. If you then run ansible-cmdb like this:

ansible-cmdb -i hosts out/ > overview.html

It should work. You may not have all the facts, but you can tweak your input script, the colums or a complete template to customize your output.

fboender avatar Aug 01 '19 12:08 fboender

Hi,

sorry, those unquoted values was my effort for anonymization of file :-)

in fact I was able to create html (or any other) report from that file. My only problem is that, for linux machines I can see disk usage with no problem, but for windows servers it is not showing anything.

Through collection I used "-a fact_path='C:\ansible_facts'" with that one line powershell so it produced earlier mentioned snippet along with all other gathered data. it only seems that ansible-cmdb can't interpret said snippet as it does not know how.

so resolution to window machines is simulating ansible disk output similar to linux machines

anyway thanks for reply 👍 I have hint how to proceed Best Regards Peter

systemfifteen avatar Aug 01 '19 17:08 systemfifteen

ran into the same thing today, but i don't fully understand. @systemfifteen could you post here if you manage to get the disk sizes? I remember from long ago one could include facter... no idea if that is still possible.

FlorianHeigl avatar Aug 21 '20 14:08 FlorianHeigl