From 58b4fea2b19697b1671912932a095b7bb9a969e0 Mon Sep 17 00:00:00 2001
From: Ted Wexler <ted@stuckinacan.com>
Date: Mon, 29 Oct 2018 14:28:23 -0400
Subject: [PATCH] Add an 'access_ip' for openstack resources to the terraform
 inventory builder script (#3592)

* Add an 'access_ip' for openstack resources to the terraform inventory builder script

* Update Openstack README

* Only use ipv4

* If there's a floating IP assigned to an openstack instance, use that for access_ip
---
 contrib/terraform/openstack/README.md | 8 --------
 contrib/terraform/terraform.py        | 2 ++
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/contrib/terraform/openstack/README.md b/contrib/terraform/openstack/README.md
index 7e31a93d6..0f3875bce 100644
--- a/contrib/terraform/openstack/README.md
+++ b/contrib/terraform/openstack/README.md
@@ -436,14 +436,6 @@ $ kubectl config use-context default-system
 kubectl version
 ```
 
-If you are using floating ip addresses then you may get this error:
-```
-Unable to connect to the server: x509: certificate is valid for 10.0.0.6, 10.233.0.1, 127.0.0.1, not 132.249.238.25
-```
-
-You can tell kubectl to ignore this condition by adding the
-`--insecure-skip-tls-verify` option.
-
 ## GlusterFS
 GlusterFS is not deployed by the standard`cluster.yml` playbook, see the
 [GlusterFS playbook documentation](../../network-storage/glusterfs/README.md)
diff --git a/contrib/terraform/terraform.py b/contrib/terraform/terraform.py
index 6feaed42a..6fb176603 100755
--- a/contrib/terraform/terraform.py
+++ b/contrib/terraform/terraform.py
@@ -328,6 +328,7 @@ def openstack_host(resource, module_name):
     attrs = {
         'access_ip_v4': raw_attrs['access_ip_v4'],
         'access_ip_v6': raw_attrs['access_ip_v6'],
+        'access_ip': raw_attrs['access_ip_v4'],
         'ip': raw_attrs['network.0.fixed_ip_v4'],
         'flavor': parse_dict(raw_attrs, 'flavor',
                              sep='_'),
@@ -685,6 +686,7 @@ def iter_host_ips(hosts, ips):
             ip = ips[host_id]
             host[1].update({
                 'access_ip_v4': ip,
+                'access_ip': ip,
                 'public_ipv4': ip,
                 'ansible_ssh_host': ip,
             })
-- 
GitLab