Set ip address to influxdb for grafana based on
provided hostname. IP address in numerical format
is required by grafana container. Mapping of
hostname in /etc/hosts is no longer required.
Change-Id: I684de737c6f8e48b5b9f256541901852d7ecc05a
Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
- rm_grafana_image
when: rm_images|default(false)|bool == true
- rm_grafana_image
when: rm_images|default(false)|bool == true
-- set_fact:
- influxdb_host_ip_mapping: "{ '{{ influxdb_hostname }}': '{{ influxdb_host_ip }}' }"
-
- name: Cleanup barometer-grafana cache directory under host
file:
path: /var/lib/grafana
- name: Cleanup barometer-grafana cache directory under host
file:
path: /var/lib/grafana
- influxdb_host: "{{ influxdb_hostname }}"
- etc_hosts:
- "{{ influxdb_host_ip_mapping }}"
+ influxdb_host: "{{ influxdb_host_ip }}"
detach: yes
restart: yes
network_mode: host
detach: yes
restart: yes
network_mode: host
# limitations under the License.
---
# 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 }}"