Use external_ip to populate the node address

Use the new external_ip inventory variable to populate node address.
Note that cluster_ip is still used if external_ip has not been set.
This makes it possible to connect to kubernetes apiserver using the external_ip
without disabling ssl cert verification.
As an added bonus, the inventory hostname is now used as the node name to make
node names more predictable.

Change-Id: I3cc25c488d68f2f858a5eb3438d96285fa7517ca
Issue-ID: OOM-2112
Signed-off-by: Michal Zegan <m.zegan@samsung.com>
diff --git a/ansible/roles/rke/templates/cluster.yml.j2 b/ansible/roles/rke/templates/cluster.yml.j2
index 737d306..51f4e28 100644
--- a/ansible/roles/rke/templates/cluster.yml.j2
+++ b/ansible/roles/rke/templates/cluster.yml.j2
@@ -1,6 +1,6 @@
 nodes:
 {% for node in groups['kubernetes'] %}
-- address: "{{ hostvars[node].cluster_ip }}"
+- address: "{{ hostvars[node].external_ip | default(hostvars[node].cluster_ip) }}"
   port: "22"
   internal_address: "{{ hostvars[node].cluster_ip }}"
   role:
@@ -13,7 +13,7 @@
 {% if node in groups['kubernetes-etcd'] %}
   - etcd
 {% endif %}
-  hostname_override: ""
+  hostname_override: "{{ node }}"
   user: "{{ rke_username }}"
   docker_socket: /var/run/docker.sock
   ssh_key: ""