I was asked today whether I’ve a list of ideas for using Ansible’s local facts, and my answer was, sadly, ‘no’. I thought I’d start one with the help of my Ansible followers.

  • Datacenter, rack location, phone number of contact person, machine owner, inventory number.
  • I often say data from special sensors can be reported on by an executable fact file.
  • Andreas reports they use executable facts to report on nginx vhosts, MySQL databases, Docker containers, installed software such as PHP and Node versions, and last patch date of the node. They use this data with ansible-cmdb, and they MOTD (message of the day) files with Ansible. example MOTD
  • Nicolai uses executable fact files to report on custom hardware information for their RevPi HAT EEPROM and detected IO modules for automatic configuration templates.
  • An idea I once heard was to use fact files to “enable” and/or “disable” nodes or services on the nodes. These were hot-standby nodes which used fact files to report they were available (or not).
  • Lars uses facts to store which non-global zones they have running on their Solaris hosts.
  • Guillaume-J explains that, when the Spectre and Meltdown vulnerabilities came out, they set up an executable local fact returning whether the host was still vulnerable or had been patched. He says they might use it more to report business-logic related facts as that’s an elegant way.
  • In openstack-ansible local facts are used for service and application states during install and upgrade, says Kevin.

Do let me know, please, how you use local facts (files or executables); I’m really interested.