ansible: Set IP address of influxdb for grafana
[barometer.git] / docker / ansible / roles / run_grafana / vars / main.yml
index 0975b59..eb2d527 100644 (file)
@@ -13,5 +13,7 @@
 # limitations under the License.
 ---
 
-influxdb_hostname: localhost
-influxdb_host_ip: 127.0.0.1
+#get hostname from invetory
+influxdb_hostname: "{{ (groups['influxdb_hosts']|default({}))[0] | default('localhost') }}"
+#get ip address for given host
+influxdb_host_ip: "{{ hostvars[influxdb_hostname].ansible_default_ipv4.address }}"