From a21189c1f0611bff6935364c8c255a88060d882d Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Mon, 23 Nov 2015 11:53:27 -0500 Subject: Removing environment and env tags. --- playbooks/gce/openshift-cluster/cluster_hosts.yml | 20 ++++++++++++++++++++ playbooks/gce/openshift-cluster/config.yml | 16 +++++++++++----- playbooks/gce/openshift-cluster/join_node.yml | 11 ++++------- playbooks/gce/openshift-cluster/list.yml | 2 +- playbooks/gce/openshift-cluster/service.yml | 5 +++-- .../gce/openshift-cluster/tasks/launch_instances.yml | 3 ++- playbooks/gce/openshift-cluster/terminate.yml | 3 +-- playbooks/gce/openshift-cluster/update.yml | 8 ++------ 8 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 playbooks/gce/openshift-cluster/cluster_hosts.yml (limited to 'playbooks/gce') diff --git a/playbooks/gce/openshift-cluster/cluster_hosts.yml b/playbooks/gce/openshift-cluster/cluster_hosts.yml new file mode 100644 index 000000000..6ccfe0e67 --- /dev/null +++ b/playbooks/gce/openshift-cluster/cluster_hosts.yml @@ -0,0 +1,20 @@ +--- +etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" + +lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" + +master_hosts: "{{ (groups['tag_host-type-master']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" + +node_hosts: "{{ (groups['tag_host-type-node']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" + +nfs_hosts: "{{ (groups['tag_host-type_nfs']|default([])) + | intersect((groups['tag_env_' ~ cluster_id]|default([]))) }}" + diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml index 4a76e406a..43da60ccd 100644 --- a/playbooks/gce/openshift-cluster/config.yml +++ b/playbooks/gce/openshift-cluster/config.yml @@ -8,8 +8,14 @@ become: no vars_files: - vars.yml + - cluster_hosts.yml tasks: - set_fact: + g_etcd_hosts: "{{ etcd_hosts }}" + g_master_hosts: "{{ master_hosts }}" + g_node_hosts: "{{ node_hosts }}" + g_lb_hosts: "{{ lb_hosts }}" + g_nfs_hosts: "{{ nfs_hosts }}" g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}" g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}" use_sdn: "{{ do_we_use_openshift_sdn }}" @@ -17,11 +23,11 @@ - include: ../../common/openshift-cluster/config.yml vars: - g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" - g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" - g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" - g_nfs_hosts: "{{ (groups['tag_host-type-nfs']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" - g_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" + g_etcd_hosts: "{{ hostvars.localhost.g_etcd_hosts }}" + g_master_hosts: "{{ hostvars.localhost.g_master_hosts }}" + g_node_hosts: "{{ hostvars.localhost.g_node_hosts }}" + g_lb_hosts: "{{ hostvars.localhost.g_lb_hosts }}" + g_nfs_hosts: "{{ hostvars.localhost.g_nfs_hosts }}" g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}" g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}" g_nodeonmaster: true diff --git a/playbooks/gce/openshift-cluster/join_node.yml b/playbooks/gce/openshift-cluster/join_node.yml index ab593b897..acf5e5110 100644 --- a/playbooks/gce/openshift-cluster/join_node.yml +++ b/playbooks/gce/openshift-cluster/join_node.yml @@ -4,13 +4,9 @@ connection: local become: no gather_facts: no - vars: - g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" vars_files: - vars.yml + - cluster_hosts.yml tasks: - name: Evaluate oo_hosts_to_update add_host: @@ -28,6 +24,7 @@ gather_facts: no vars_files: - vars.yml + - cluster_hosts.yml tasks: - name: Evaluate oo_nodes_to_config add_host: @@ -38,11 +35,11 @@ - name: Evaluate oo_first_master add_host: - name: "{{ g_master_hosts | first }}" + name: "{{ master_hosts | first }}" ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" groups: oo_first_master - when: g_master_hosts is defined and g_master_hosts|length > 0 + when: master_hosts is defined and master_hosts|length > 0 #- include: config.yml - include: ../../common/openshift-node/config.yml diff --git a/playbooks/gce/openshift-cluster/list.yml b/playbooks/gce/openshift-cluster/list.yml index b9ff89c79..e67685912 100644 --- a/playbooks/gce/openshift-cluster/list.yml +++ b/playbooks/gce/openshift-cluster/list.yml @@ -7,7 +7,7 @@ vars_files: - vars.yml tasks: - - set_fact: scratch_group=tag_env-{{ cluster_id }} + - set_fact: scratch_group=tag_clusterid-{{ cluster_id }} when: cluster_id != '' - set_fact: scratch_group=all when: cluster_id == '' diff --git a/playbooks/gce/openshift-cluster/service.yml b/playbooks/gce/openshift-cluster/service.yml index 337ba7e44..8925de4cb 100644 --- a/playbooks/gce/openshift-cluster/service.yml +++ b/playbooks/gce/openshift-cluster/service.yml @@ -6,6 +6,7 @@ gather_facts: no vars_files: - vars.yml + - cluster_hosts.yml tasks: - fail: msg="cluster_id is required to be injected in this playbook" when: cluster_id is not defined @@ -15,14 +16,14 @@ groups: g_service_nodes ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" - with_items: "{{ g_node_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}" + 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_sudo: "{{ deployment_vars[deployment_type].sudo }}" - with_items: "{{ g_master_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}" + with_items: "{{ master_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}" - include: ../../common/openshift-node/service.yml - include: ../../common/openshift-master/service.yml diff --git a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml index 2360a3263..488b62eb9 100644 --- a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml +++ b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml @@ -16,7 +16,8 @@ #service_account_permissions: "datastore,logging-write" tags: - created-by-{{ lookup('env', 'LOGNAME') |default(cluster, true) }} - - env-{{ cluster }} + - environment-{{ cluster_env }} + - clusterid-{{ cluster_id }} - host-type-{{ type }} - sub-host-type-{{ g_sub_host_type }} when: instances |length > 0 diff --git a/playbooks/gce/openshift-cluster/terminate.yml b/playbooks/gce/openshift-cluster/terminate.yml index f4e89983b..faa46c0d6 100644 --- a/playbooks/gce/openshift-cluster/terminate.yml +++ b/playbooks/gce/openshift-cluster/terminate.yml @@ -7,13 +7,12 @@ vars_files: - vars.yml tasks: - - set_fact: scratch_group=tag_env-{{ cluster_id }} - add_host: name: "{{ item }}" groups: oo_hosts_to_terminate ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" - with_items: groups[scratch_group] | default([], true) | difference(['localhost']) | difference(groups.status_terminated | default([], true)) + with_items: (groups['tag_clusterid-' ~ cluster_id] | default([])) | difference(['localhost']) - name: Unsubscribe VMs hosts: oo_hosts_to_terminate diff --git a/playbooks/gce/openshift-cluster/update.yml b/playbooks/gce/openshift-cluster/update.yml index d60662397..6313d0b95 100644 --- a/playbooks/gce/openshift-cluster/update.yml +++ b/playbooks/gce/openshift-cluster/update.yml @@ -4,13 +4,9 @@ become: no connection: local gather_facts: no - vars: - g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}" - g_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}" vars_files: - vars.yml + - cluster_hosts.yml tasks: - name: Evaluate oo_hosts_to_update add_host: @@ -18,7 +14,7 @@ groups: oo_hosts_to_update ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" - with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}" + with_items: "{{ master_hosts | union(node_hosts) | union(etcd_hosts) | default([]) }}" - include: ../../common/openshift-cluster/update_repos_and_packages.yml -- cgit v1.2.3 From 67b3fff8257072095ebdebfdfe5c429efea3a8d8 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 18 Dec 2015 14:01:34 -0500 Subject: Cleanup and fixes for cluster_id change - Move debug_level into vars.yml and byo inventory - change variables in cluster_hosts.yml to be g_* and update playbooks to use those values directly instead of setting them indirectly - added a new g_all_hosts entry in cluster_hosts to use in the update playbook instead of unioning all host types within the playbook - added a cluster_hosts.yml for the byo playbook --- playbooks/gce/openshift-cluster/cluster_hosts.yml | 29 +++++++++--------- playbooks/gce/openshift-cluster/config.yml | 37 +++++------------------ playbooks/gce/openshift-cluster/update.yml | 4 +-- playbooks/gce/openshift-cluster/vars.yml | 3 +- 4 files changed, 25 insertions(+), 48 deletions(-) (limited to 'playbooks/gce') diff --git a/playbooks/gce/openshift-cluster/cluster_hosts.yml b/playbooks/gce/openshift-cluster/cluster_hosts.yml index 6ccfe0e67..bea3d0e55 100644 --- a/playbooks/gce/openshift-cluster/cluster_hosts.yml +++ b/playbooks/gce/openshift-cluster/cluster_hosts.yml @@ -1,20 +1,19 @@ --- -etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) - | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) - | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" +g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" -lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) - | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) - | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" +g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" -master_hosts: "{{ (groups['tag_host-type-master']|default([])) - | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) - | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" +g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" -node_hosts: "{{ (groups['tag_host-type-node']|default([])) - | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) - | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" - -nfs_hosts: "{{ (groups['tag_host-type_nfs']|default([])) - | intersect((groups['tag_env_' ~ cluster_id]|default([]))) }}" +g_node_hosts: "{{ (groups['tag_host-type-node']|default([])) + | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) + | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" +g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) + | union(g_lb_hosts) | default([]) }}" diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml index 43da60ccd..3231ecc8e 100644 --- a/playbooks/gce/openshift-cluster/config.yml +++ b/playbooks/gce/openshift-cluster/config.yml @@ -1,39 +1,16 @@ --- # TODO: fix firewall related bug with GCE and origin, since GCE is overriding # /etc/sysconfig/iptables - -- hosts: localhost - gather_facts: no - connection: local - become: no - vars_files: - - vars.yml - - cluster_hosts.yml - tasks: - - set_fact: - g_etcd_hosts: "{{ etcd_hosts }}" - g_master_hosts: "{{ master_hosts }}" - g_node_hosts: "{{ node_hosts }}" - g_lb_hosts: "{{ lb_hosts }}" - g_nfs_hosts: "{{ nfs_hosts }}" - g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}" - g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}" - use_sdn: "{{ do_we_use_openshift_sdn }}" - sdn_plugin: "{{ sdn_network_plugin }}" - - include: ../../common/openshift-cluster/config.yml + vars_files: + - ../../gce/openshift-cluster/vars.yml + - ../../gce/openshift-cluster/cluster_hosts.yml vars: - g_etcd_hosts: "{{ hostvars.localhost.g_etcd_hosts }}" - g_master_hosts: "{{ hostvars.localhost.g_master_hosts }}" - g_node_hosts: "{{ hostvars.localhost.g_node_hosts }}" - g_lb_hosts: "{{ hostvars.localhost.g_lb_hosts }}" - g_nfs_hosts: "{{ hostvars.localhost.g_nfs_hosts }}" - g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}" - g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}" + g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}" + g_sudo: "{{ deployment_vars[deployment_type].sudo }}" g_nodeonmaster: true openshift_cluster_id: "{{ cluster_id }}" - openshift_debug_level: 2 + openshift_debug_level: "{{ debug_level }}" openshift_deployment_type: "{{ deployment_type }}" openshift_hostname: "{{ gce_private_ip }}" - openshift_use_openshift_sdn: "{{ hostvars.localhost.use_sdn }}" - os_sdn_network_plugin_name: "{{ hostvars.localhost.sdn_plugin }}" + openshift_use_openshift_sdn: "{{ do_we_use_openshift_sdn }}" diff --git a/playbooks/gce/openshift-cluster/update.yml b/playbooks/gce/openshift-cluster/update.yml index 6313d0b95..dadceae58 100644 --- a/playbooks/gce/openshift-cluster/update.yml +++ b/playbooks/gce/openshift-cluster/update.yml @@ -1,8 +1,8 @@ --- - name: Populate oo_hosts_to_update group hosts: localhost - become: no connection: local + become: no gather_facts: no vars_files: - vars.yml @@ -14,7 +14,7 @@ groups: oo_hosts_to_update ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}" ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}" - with_items: "{{ master_hosts | union(node_hosts) | union(etcd_hosts) | default([]) }}" + with_items: "{{ g_all_hosts | default([]) }}" - include: ../../common/openshift-cluster/update_repos_and_packages.yml diff --git a/playbooks/gce/openshift-cluster/vars.yml b/playbooks/gce/openshift-cluster/vars.yml index a8ce8eb22..bdb39923e 100644 --- a/playbooks/gce/openshift-cluster/vars.yml +++ b/playbooks/gce/openshift-cluster/vars.yml @@ -1,6 +1,7 @@ --- do_we_use_openshift_sdn: true -sdn_network_plugin: redhat/openshift-ovs-subnet +sdn_network_plugin: redhat/openshift-ovs-subnet +debug_level: 2 # os_sdn_network_plugin_name can be ovssubnet or multitenant, see https://docs.openshift.org/latest/architecture/additional_concepts/sdn.html#ovssubnet-plugin-operation deployment_vars: origin: -- cgit v1.2.3 From da8165469a43dc3bf43b2024a76edcd04be0bb81 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 18 Dec 2015 14:35:35 -0500 Subject: Fix error in byo cluster_hosts.yml --- playbooks/gce/openshift-cluster/cluster_hosts.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'playbooks/gce') diff --git a/playbooks/gce/openshift-cluster/cluster_hosts.yml b/playbooks/gce/openshift-cluster/cluster_hosts.yml index bea3d0e55..2bfcedfc9 100644 --- a/playbooks/gce/openshift-cluster/cluster_hosts.yml +++ b/playbooks/gce/openshift-cluster/cluster_hosts.yml @@ -15,5 +15,8 @@ g_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_clusterid-' ~ cluster_id]|default([]))) | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}" +g_nfs_hosts: "{{ (groups['tag_host-type-nfs']|default([])) + | intersect((groups['tag_environment-' ~ cluster_id]|default([]))) }}" + g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | union(g_lb_hosts) | default([]) }}" -- cgit v1.2.3