summaryrefslogtreecommitdiffstats
path: root/playbooks/gce/openshift-cluster/launch.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.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.yml')
-rw-r--r--playbooks/gce/openshift-cluster/launch.yml63
1 files changed, 63 insertions, 0 deletions
diff --git a/playbooks/gce/openshift-cluster/launch.yml b/playbooks/gce/openshift-cluster/launch.yml
new file mode 100644
index 000000000..889d92d40
--- /dev/null
+++ b/playbooks/gce/openshift-cluster/launch.yml
@@ -0,0 +1,63 @@
+---
+- name: Launch instance(s)
+ hosts: localhost
+ connection: local
+ gather_facts: no
+ vars_files:
+ - vars.yml
+ tasks:
+ - set_fact: k8s_type="master"
+
+ - name: Generate master instance names(s)
+ set_fact: scratch={{ cluster_id }}-{{ k8s_type }}-{{ '%05x' |format( 1048576 |random) }}
+ register: master_names_output
+ with_sequence: start=1 end={{ masters }}
+
+ # These set_fact's cannot be combined
+ - set_fact:
+ master_names_string: "{% for item in master_names_output.results %}{{ item.ansible_facts.scratch }} {% endfor %}"
+
+ - set_fact:
+ master_names: "{{ master_names_string.strip().split(' ') }}"
+
+ - include: launch_instances.yml
+ vars:
+ instances: "{{ master_names }}"
+ cluster: "{{ cluster_id }}"
+ type: "{{ k8s_type }}"
+ group_name: "tag_env-host-type-{{ cluster_id }}-openshift-master"
+
+ - set_fact: k8s_type="node"
+
+ - name: Generate node instance names(s)
+ set_fact: scratch={{ cluster_id }}-{{ k8s_type }}-{{ '%05x' |format( 1048576 |random) }}
+ register: node_names_output
+ with_sequence: start=1 end={{ nodes }}
+
+ # These set_fact's cannot be combined
+ - set_fact:
+ node_names_string: "{% for item in node_names_output.results %}{{ item.ansible_facts.scratch }} {% endfor %}"
+
+ - set_fact:
+ node_names: "{{ node_names_string.strip().split(' ') }}"
+
+ - include: launch_instances.yml
+ vars:
+ instances: "{{ node_names }}"
+ cluster: "{{ cluster_id }}"
+ type: "{{ k8s_type }}"
+
+- hosts: "tag_env-{{ cluster_id }}"
+ roles:
+ - openshift_repos
+ - os_update_latest
+
+- include: ../openshift-master/config.yml
+ vars:
+ oo_host_group_exp: "groups[\"tag_env-host-type-{{ cluster_id }}-openshift-master\"]"
+ oo_env: "{{ cluster_id }}"
+
+- include: ../openshift-node/config.yml
+ vars:
+ oo_host_group_exp: "groups[\"tag_env-host-type-{{ cluster_id }}-openshift-node\"]"
+ oo_env: "{{ cluster_id }}"