Selaa lähdekoodia

Improve docs and consistency of setting the ssh_user

Jason DeTiberus 9 vuotta sitten
vanhempi
commit
2f3458447c

+ 30 - 10
README_GCE.md

@@ -42,12 +42,17 @@ Create a gce.ini file for GCE
 Mandatory customization variables (check the values according to your tenant):
 * zone = europe-west1-d
 * network = default
-* gce_machine_type = n1-standard-2
-* gce_machine_master_type = n1-standard-1
-* gce_machine_node_type = n1-standard-2
-* gce_machine_image = preinstalled-slave-50g-v5
-* gce_machine_master_image = preinstalled-slave-50g-v5
-* gce_machine_node_image = preinstalled-slave-50g-v5
+
+Optional Variable Overrides:
+* gce_ssh_user - ssh user, defaults to the current logged in user
+* gce_machine_type = n1-standard-1 - default machine type
+* gce_machine_etcd_type = n1-standard-1 - machine type for etcd hosts
+* gce_machine_master_type = n1-standard-1 - machine type for master hosts
+* gce_machine_node_type = n1-standard-1 - machine type for node hosts
+* gce_machine_image = centos-7 - default image
+* gce_machine_etcd_image = centos-7 - image for etcd hosts
+* gce_machine_master_image = centos-7 - image for master hosts
+* gce_machine_node_image = centos-7 - image for node hosts
 
 
 1. vi ~/.gce/gce.ini
@@ -62,9 +67,9 @@ network = default
 gce_machine_type = n1-standard-2
 gce_machine_master_type = n1-standard-1
 gce_machine_node_type = n1-standard-2
-gce_machine_image = preinstalled-slave-50g-v5
-gce_machine_master_image = preinstalled-slave-50g-v5
-gce_machine_node_image = preinstalled-slave-50g-v5
+gce_machine_image = centos-7
+gce_machine_master_image = centos-7
+gce_machine_node_image = centos-7
 
 ```
 1. Define the environment variable GCE_INI_PATH so gce.py can pick it up and bin/cluster can also read it
@@ -92,10 +97,15 @@ argument will result in all gce instances being listed)
 
 Creating a cluster
 ------------------
-1. To create a cluster with one master and two nodes
+1. To create a cluster with one master, one infra node, and two compute nodes
 ```
   bin/cluster create gce <cluster-id>
 ```
+1. To create a cluster with 3 masters, 3 etcd hosts, 2 infra nodes and 10
+compute nodes
+```
+  bin/cluster create gce -m 3 -e 3 -i 2 -n 10 <cluster-id>
+```
 
 Updating a cluster
 ---------------------
@@ -104,6 +114,16 @@ Updating a cluster
   bin/cluster update gce <cluster-id>
 ```
 
+Add additional nodes
+---------------------
+1. To add additional infra nodes
+```
+  bin/cluster add-nodes gce -i <num nodes> <cluster-id>
+```
+1. To add additional compute nodes
+```
+  bin/cluster add-nodes gce -n <num nodes> <cluster-id>
+```
 Terminating a cluster
 ---------------------
 1. To terminate the cluster

+ 1 - 1
playbooks/gce/openshift-cluster/config.yml

@@ -4,7 +4,7 @@
   - ../../gce/openshift-cluster/vars.yml
   - ../../gce/openshift-cluster/cluster_hosts.yml
   vars:
-    g_ssh_user: "{{ lookup('env', 'gce_ssh_user') | default(deployment_vars[deployment_type].ssh_user, true) }}"
+    g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
     g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"

+ 1 - 1
playbooks/gce/openshift-cluster/list.yml

@@ -14,7 +14,7 @@
   - add_host:
       name: "{{ item }}"
       groups: oo_list_hosts
-      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     with_items: groups[scratch_group] | default([], true) | difference(['localhost']) | difference(groups.status_terminated | default([], true))
 

+ 2 - 2
playbooks/gce/openshift-cluster/service.yml

@@ -14,14 +14,14 @@
   - add_host:
       name: "{{ item }}"
       groups: g_service_nodes
-      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     with_items: "{{ node_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
 
   - add_host:
       name: "{{ item }}"
       groups: g_service_masters
-      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     with_items: "{{ master_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
 

+ 1 - 1
playbooks/gce/openshift-cluster/tasks/launch_instances.yml

@@ -38,7 +38,7 @@
   add_host:
     hostname: "{{ item.name }}"
     ansible_ssh_host: "{{ item.public_ip }}"
-    ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+    ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
     ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     groups: "{{ item.tags | oo_prepend_strings_in_list('tag_') | join(',') }}"
     gce_public_ip: "{{ item.public_ip }}"

+ 1 - 1
playbooks/gce/openshift-cluster/terminate.yml

@@ -10,7 +10,7 @@
   - add_host:
       name: "{{ item }}"
       groups: oo_hosts_to_terminate
-      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     with_items: (groups['tag_clusterid-' ~ cluster_id] | default([])) | difference(['localhost'])
 

+ 1 - 1
playbooks/gce/openshift-cluster/update.yml

@@ -12,7 +12,7 @@
     add_host:
       name: "{{ item }}"
       groups: oo_hosts_to_update
-      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
+      ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
     with_items: "{{ g_all_hosts | default([]) }}"
 

+ 2 - 2
playbooks/gce/openshift-cluster/vars.yml

@@ -4,14 +4,14 @@ debug_level: 2
 deployment_rhel7_ent_base:
   image: rhel-7
   machine_type: n1-standard-1
-  ssh_user:
+  ssh_user: "{{ lookup('env', 'gce_ssh_user') |  default(ansible_ssh_user, true) }}"
   sudo: yes
 
 deployment_vars:
   origin:
     image: centos-7
     machine_type: n1-standard-1
-    ssh_user: "{{ ansible_ssh_user }}"
+    ssh_user: "{{ lookup('env', 'gce_ssh_user') |  default(ansible_ssh_user, true) }}"
     sudo: yes
   online:
     image: libra-rhel7