summaryrefslogtreecommitdiffstats
path: root/playbooks/gce/openshift-cluster
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-03-13 03:58:23 -0400
committerJhon Honce <jhonce@redhat.com>2015-03-24 11:13:26 -0700
commit9199379f94f6b11a4841e31f6c58a11c1e9f8c3a (patch)
tree3250d896343b148edebf4e4e7283261c3eb60acb /playbooks/gce/openshift-cluster
parente337235d471468b400acadcbd56ad14f39a2a222 (diff)
downloadopenshift-9199379f94f6b11a4841e31f6c58a11c1e9f8c3a.tar.gz
openshift-9199379f94f6b11a4841e31f6c58a11c1e9f8c3a.tar.bz2
openshift-9199379f94f6b11a4841e31f6c58a11c1e9f8c3a.tar.xz
openshift-9199379f94f6b11a4841e31f6c58a11c1e9f8c3a.zip
Various fixes
- playbooks/gce/openshift-cluster: - Remove some stray debugging statements - Some minor formatting fixes - removing un-necessary quotes - cleaning up some jinja templates for readability - add a play to the launch playbook to apply the os_update_latest role on all hosts in the new environment - improve setting groups and gce_public_ip when using add_host module - set gce_public_ip as a variable for the host using the returned gce instance_data - add a group for each tag configured on the host (pre-pending tag_ to the tag name) - update the openshift-master/config.yml and openshift-node/config.yml includes to use the tag_env-host-type groups - openshift-{master,node}/config.yml - Some cleanup - remove some extraneous quotes - remove connection: ssh from remote hosts, since it is the default - remove user: root and instead set ansible_ssh_user in inventory/gce/group_vars/all - set openshift_public_ip and openshift_env to templated values in inventory/gce/group_vars/all as well - no longer set openshift_node_ips for the master host, since nodes will register themselves now when they are configured (prevent reboot on adding nodes) - move setting openshift_master_ips and openshift_public_master_ips using set_fact and instead use the vars: of the 'Configure Instances' play
Diffstat (limited to 'playbooks/gce/openshift-cluster')
-rw-r--r--playbooks/gce/openshift-cluster/launch.yml22
-rw-r--r--playbooks/gce/openshift-cluster/launch_instances.yml8
2 files changed, 16 insertions, 14 deletions
diff --git a/playbooks/gce/openshift-cluster/launch.yml b/playbooks/gce/openshift-cluster/launch.yml
index ba9d58a74..c70c199c6 100644
--- a/playbooks/gce/openshift-cluster/launch.yml
+++ b/playbooks/gce/openshift-cluster/launch.yml
@@ -3,21 +3,19 @@
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) }}"
+ - name: Generate master instance names(s)
+ set_fact: scratch={{ cluster_id }}-{{ k8s_type }}-{{ '%05x' |format( 1048576 |random) }}
register: instance_names_output
with_sequence: start=1 end={{ masters }}
# These set_fact's cannot be combined
- set_fact:
- instance_names_string: "{% for item in instance_names_output.results %}{{item.ansible_facts.scratch}} {% endfor %}"
+ instance_names_string: "{% for item in instance_names_output.results %}{{ item.ansible_facts.scratch }} {% endfor %}"
- set_fact:
master_names: "{{ instance_names_string.strip().split(' ') }}"
@@ -31,14 +29,14 @@
- set_fact: k8s_type="node"
- - name: "Generate node instance names(s)"
- set_fact: scratch="{{ cluster_id }}-{{ k8s_type }}-{{ '%05x' |format( 1048576 |random) }}"
+ - name: Generate node instance names(s)
+ set_fact: scratch={{ cluster_id }}-{{ k8s_type }}-{{ '%05x' |format( 1048576 |random) }}
register: instance_names_output
with_sequence: start=1 end={{ nodes }}
# These set_fact's cannot be combined
- set_fact:
- instance_names_string: "{% for item in instance_names_output.results %}{{item.ansible_facts.scratch}} {% endfor %}"
+ instance_names_string: "{% for item in instance_names_output.results %}{{ item.ansible_facts.scratch }} {% endfor %}"
- set_fact:
node_names: "{{ instance_names_string.strip().split(' ') }}"
@@ -48,15 +46,17 @@
instances: "{{ node_names }}"
cluster: "{{ cluster_id }}"
type: "{{ k8s_type }}"
- group_name: "tag_env-host-type-{{ cluster_id }}-openshift-node"
+- hosts: "tag_env-{{ cluster_id }}"
+ roles:
+ - os_update_latest
- include: ../openshift-master/config.yml
vars:
- oo_host_group_exp: "{{ master_names }}"
+ 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: "{{ node_names }}"
+ oo_host_group_exp: "groups[\"tag_env-host-type-{{ cluster_id }}-openshift-node\"]"
oo_env: "{{ cluster_id }}"
diff --git a/playbooks/gce/openshift-cluster/launch_instances.yml b/playbooks/gce/openshift-cluster/launch_instances.yml
index ff19b94d8..443e763de 100644
--- a/playbooks/gce/openshift-cluster/launch_instances.yml
+++ b/playbooks/gce/openshift-cluster/launch_instances.yml
@@ -19,15 +19,17 @@
register: gce
- name: Add new instances public IPs
- add_host: "hostname={{ item.name }} ansible_ssh_host={{ item.public_ip }} groups={{ group_name }}"
+ 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
-- debug: var=gce
-
- 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