Hello Guys,
I have recently worked on a project which involved fetching a data from multiple server at the run time and manipulating it and displaying it Grafana dashboard. the most interesting part of it was generating the inventory at runtime and using it in the same playbook
let us say we have a mysql db with table contain the information of all the servers
currently showing 3 column which are of our interest hostname,ip and some var value
building the dynamic inventory the playbook look like below
The host.j2 file present in the templates look like this
This will build the inventory at the run time as well as the meta flag at the bottom will help us to refresh the inventory to use it on all the host which it will return
let me know if you want to know on any other topics
No comments:
Post a Comment