summaryrefslogtreecommitdiffstats
path: root/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/gce/openshift-cluster/tasks/launch_instances.yml')
-rw-r--r--playbooks/gce/openshift-cluster/tasks/launch_instances.yml21
1 files changed, 18 insertions, 3 deletions
diff --git a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
index e300b5b5a..c428cb465 100644
--- a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
@@ -20,22 +20,37 @@
- host-type-{{ type }}
- sub-host-type-{{ g_sub_host_type }}
- env-host-type-{{ cluster }}-openshift-{{ type }}
- when: instances |length > 0
+ when: instances |length > 0
register: gce
+- set_fact:
+ node_label:
+ # There doesn't seem to be a way to get the region directly, so parse it out of the zone.
+ region: "{{ gce.zone | regex_replace('^(.*)-.*$', '\\\\1') }}"
+ type: "{{ g_sub_host_type }}"
+ when: instances |length > 0 and type == "node"
+
+- set_fact:
+ node_label:
+ # There doesn't seem to be a way to get the region directly, so parse it out of the zone.
+ region: "{{ gce.zone | regex_replace('^(.*)-.*$', '\\\\1') }}"
+ type: "{{ type }}"
+ when: instances |length > 0 and type != "node"
+
- name: Add new instances to groups and set variables needed
add_host:
hostname: "{{ item.name }}"
- ansible_ssh_host: "{{ item.name }}"
+ ansible_ssh_host: "{{ item.public_ip }}"
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: "{{ item.tags | oo_prepend_strings_in_list('tag_') | join(',') }}"
gce_public_ip: "{{ item.public_ip }}"
gce_private_ip: "{{ item.private_ip }}"
+ openshift_node_labels: "{{ node_label }}"
with_items: gce.instance_data | default([], true)
- name: Wait for ssh
- wait_for: port=22 host={{ item.name }}
+ wait_for: port=22 host={{ item.public_ip }}
with_items: gce.instance_data | default([], true)
- name: Wait for user setup