Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Created October 22, 2022 08:38
Show Gist options
  • Save dmccuk/e8129da4e93708f5715039c17082bc92 to your computer and use it in GitHub Desktop.
Save dmccuk/e8129da4e93708f5715039c17082bc92 to your computer and use it in GitHub Desktop.

Get facts from Windows servers

In this vide I want to show you, as aLinux admin, how to get facts from a windows wserver.

To set the scene, you're a Linux admin who works with Ansible. You already collect facts, including custom facts from Linux servers, but you've been asked to extent this to a small number of Windows servers. Apart from the usual facts collected by the setup module, we also need to know the versions of installed software so we can get a picture of our estate. You don't know how to write powershell but you know it can;t be that hard.

This is what I'm going to show you today:

  • I already have Ansible able to manage a windows server. IF you don't, check out my other video on gtting that setup: https://youtu.be/aPN18jLRkJI
  • I'm goint to show you how to collect facts from a windows server using the setup module.
  • Next I'll add a custom facts to collect all installed applications and their versions.
  • Then I'll show you how to collect specific versions of installed applications and capture them in a local facts file.
  • We'll put this file back to our linux server and check it to see what that looks like.

All the code will be available on this page. Please subscribe and like my work!

Lets get started...

Confirm ansible can manage our Windows server

To be able to confirm this and follow along, you need to have a working setup. Follow the video link above and follow my steps to get Ansible managing windows servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment