Hi Guys,
Can someone guide me on how to store the facts for all hosts in inventory into a mysql database.
In other words, output data of setup module to mysql.
Appreciate ideas/suggestions.
–Anil
Hi Guys,
Can someone guide me on how to store the facts for all hosts in inventory into a mysql database.
In other words, output data of setup module to mysql.
Appreciate ideas/suggestions.
–Anil
A fact cache plugin can do this easily, check the memcached and redis ones as an example.
The host facts are dictionary objects and will most likely not have exactly the same number of elements within them (unless you have a trivially uniform environment!) so a MySQL backend isn’t a particularly useful fit.
Personally (on Red Hat), I prefer to use the jsonfile backend and a 1 day validity, but specifying a directory under /dev/shm to store the files, thereby effectively running it in a ramdisk. This provides a decent performance gain while still allowing the standard Unix file system security to be applied.
thanks for your advice,Brian. Tried redis, so each host (key)and its facts(value) are stored as a key value pair. is there a way I can get the selective facts with in a given key value?.
For example, if I just want to retrieve testhost1’s HOSTNAME, ansible_default_ipv4 only, is that possible
Essentially I wanted to parse the selective facts output into a excel/csv with one row per host in easy readable format.
Thank you for the ideas, Uditha Desilva.