summaryrefslogtreecommitdiffstats
path: root/playbooks/gce/openshift-cluster/launch_instances.yml
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2015-03-24 14:16:31 -0700
committerJhon Honce <jhonce@redhat.com>2015-03-24 14:16:31 -0700
commitf2f0167b605b541ad74d0aef0392609772692f0d (patch)
tree8f377eaba382dc1515a050068e5c3fa83c5106ea /playbooks/gce/openshift-cluster/launch_instances.yml
parent43ed89371aa2fce56d5e2b41af35a3ae902e92e6 (diff)
parent4dc8ca74f47bcbe0fd6285b0d73cc5b193be17a9 (diff)
downloadopenshift-f2f0167b605b541ad74d0aef0392609772692f0d.tar.gz
openshift-f2f0167b605b541ad74d0aef0392609772692f0d.tar.bz2
openshift-f2f0167b605b541ad74d0aef0392609772692f0d.tar.xz
openshift-f2f0167b605b541ad74d0aef0392609772692f0d.zip
Merge pull request #97 from jwhonce/wip/cluster
Use ansible playbook to initialize openshift cluster
Diffstat (limited to 'playbooks/gce/openshift-cluster/launch_instances.yml')
-rw-r--r--playbooks/gce/openshift-cluster/launch_instances.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/playbooks/gce/openshift-cluster/launch_instances.yml b/playbooks/gce/openshift-cluster/launch_instances.yml
new file mode 100644
index 000000000..20e31d990
--- /dev/null
+++ b/playbooks/gce/openshift-cluster/launch_instances.yml
@@ -0,0 +1,39 @@
+
+- set_fact:
+ machine_type: "{{ lookup('env', 'gce_machine_type') |default('n1-standard-1', true) }}"
+ machine_image: "{{ lookup('env', 'gce_machine_image') |default('libra-rhel7', true) }}"
+
+- name: Launch instance(s)
+ gce:
+ instance_names: "{{ instances }}"
+ machine_type: "{{ machine_type }}"
+ image: "{{ machine_image }}"
+ service_account_email: "{{ lookup('env', 'gce_service_account_email_address') }}"
+ pem_file: "{{ lookup('env', 'gce_service_account_pem_file_path') }}"
+ project_id: "{{ lookup('env', 'gce_project_id') }}"
+ tags:
+ - "created-by-{{ lookup('env', 'LOGNAME') |default(cluster, true) }}"
+ - "env-{{ cluster }}"
+ - "host-type-{{ type }}"
+ - "env-host-type-{{ cluster }}-openshift-{{ type }}"
+ register: gce
+
+- name: Add new instances public IPs
+ add_host:
+ hostname: "{{ item.name }}"
+ ansible_ssh_host: "{{ item.public_ip }}"
+ groups: "{{ item.tags | oo_prepend_strings_in_list('tag_') | join(',') }}"
+ gce_public_ip: "{{ item.public_ip }}"
+ with_items: gce.instance_data
+
+- name: Wait for ssh
+ wait_for: "port=22 host={{ item.public_ip }}"
+ with_items: gce.instance_data
+
+- name: Wait for root user setup
+ command: "ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null root@{{ item.public_ip }} echo root user is setup"
+ register: result
+ until: result.rc == 0
+ retries: 20
+ delay: 10
+ with_items: gce.instance_data