I’m attempting to create an elasticsearch datasource via an HTTP POST call from an Ansible playbook, but I cannot get it working correctly. I created the datasource manually and looked at the request payload in chrome to get the required fields, then created a ‘uri’ task in Ansible with the correct fields filled out. However, when I run the playbook it creates the datasource but when I go to edit the datasource none of the fields are filled out, and if I try and use the DS in a graph, it gives me an error and there’s no data for it to graph.
Normally I would assume that my Ansible task is wrong, but I simply copied this from a similar task that sets up both graphite and aws datasources, and they work just fine. The elasticsearch DS is the only one that’s giving me problems.
Here’s screenshots of the DS config after manual creation and automatic creation:
On the datasources main screen (see image below) it actually looks like it has been configured with the correct elasticsearch source url at least, but it doesn’t list this inside the actual DS config. Also, as I mentioned, it doesn’t appear to be working as it can’t find any data and it gives a cryptic error on the graph (screenshot below):
Does anyone know how I can get this working?