summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-12-14 09:08:56 -0500
committerKenny Woodson <kwoodson@redhat.com>2015-12-14 09:08:56 -0500
commite4ecb0ea7415e0db3957926e5c6a571c36e2ffd1 (patch)
treea1b1bcc5970889d913193b324423bee1ee3c8dbb
parent40ce28e760021571504efe3b89a4034b98c64f4b (diff)
parent7c945d07d2a61e7334a10388d37ac28f1bc58ce1 (diff)
downloadopenshift-e4ecb0ea7415e0db3957926e5c6a571c36e2ffd1.tar.gz
openshift-e4ecb0ea7415e0db3957926e5c6a571c36e2ffd1.tar.bz2
openshift-e4ecb0ea7415e0db3957926e5c6a571c36e2ffd1.tar.xz
openshift-e4ecb0ea7415e0db3957926e5c6a571c36e2ffd1.zip
Merge pull request #1028 from kwoodson/remove_env_host_type
Removing env-host-type in preparation of env and environment changes.
-rw-r--r--bin/openshift_ansible/awsutil.py12
-rwxr-xr-xbin/oscp8
-rwxr-xr-xbin/ossh8
-rwxr-xr-xbin/ossh_bash_completion6
-rw-r--r--bin/ossh_zsh_completion6
-rw-r--r--bin/zsh_functions/_ossh2
-rw-r--r--filter_plugins/oo_filters.py1
-rw-r--r--playbooks/adhoc/create_pv/create_pv.yaml10
-rw-r--r--playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml2
-rw-r--r--playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml2
-rw-r--r--playbooks/adhoc/s3_registry/s3_registry.yml2
-rw-r--r--playbooks/aws/openshift-cluster/config.yml8
-rw-r--r--playbooks/aws/openshift-cluster/scaleup.yml8
-rw-r--r--playbooks/aws/openshift-cluster/service.yml4
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml7
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml1
-rw-r--r--playbooks/aws/openshift-cluster/update.yml13
-rw-r--r--playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml8
-rw-r--r--playbooks/byo/openshift-cluster/config.yml8
-rw-r--r--playbooks/byo/openshift-cluster/scaleup.yml8
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml8
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml8
-rw-r--r--playbooks/common/openshift-cluster/evaluate_groups.yml42
-rw-r--r--playbooks/gce/openshift-cluster/config.yml8
-rw-r--r--playbooks/gce/openshift-cluster/join_node.yml9
-rw-r--r--playbooks/gce/openshift-cluster/service.yml6
-rw-r--r--playbooks/gce/openshift-cluster/tasks/launch_instances.yml1
-rw-r--r--playbooks/gce/openshift-cluster/update.yml9
-rw-r--r--playbooks/gce/openshift-cluster/wip.yml2
-rw-r--r--playbooks/libvirt/openshift-cluster/config.yml8
-rw-r--r--playbooks/libvirt/openshift-cluster/service.yml4
-rw-r--r--playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml2
-rw-r--r--playbooks/libvirt/openshift-cluster/templates/domain.xml1
-rw-r--r--playbooks/libvirt/openshift-cluster/update.yml10
-rw-r--r--playbooks/openstack/openshift-cluster/config.yml8
-rw-r--r--playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml6
-rw-r--r--playbooks/openstack/openshift-cluster/launch.yml8
-rw-r--r--playbooks/openstack/openshift-cluster/update.yml10
38 files changed, 139 insertions, 135 deletions
diff --git a/bin/openshift_ansible/awsutil.py b/bin/openshift_ansible/awsutil.py
index 45345007c..ba32b4dbd 100644
--- a/bin/openshift_ansible/awsutil.py
+++ b/bin/openshift_ansible/awsutil.py
@@ -58,7 +58,7 @@ class AwsUtil(object):
def get_environments(self):
"""Searches for env tags in the inventory and returns all of the envs found."""
- pattern = re.compile(r'^tag_environment_(.*)')
+ pattern = re.compile(r'^tag_env_(.*)')
envs = []
inv = self.get_inventory()
@@ -106,13 +106,13 @@ class AwsUtil(object):
inst_by_env = {}
for _, host in inv['_meta']['hostvars'].items():
# If you don't have an environment tag, we're going to ignore you
- if 'ec2_tag_environment' not in host:
+ if 'ec2_tag_env' not in host:
continue
- if host['ec2_tag_environment'] not in inst_by_env:
- inst_by_env[host['ec2_tag_environment']] = {}
+ if host['ec2_tag_env'] not in inst_by_env:
+ inst_by_env[host['ec2_tag_env']] = {}
host_id = "%s:%s" % (host['ec2_tag_Name'], host['ec2_id'])
- inst_by_env[host['ec2_tag_environment']][host_id] = host
+ inst_by_env[host['ec2_tag_env']][host_id] = host
return inst_by_env
@@ -154,7 +154,7 @@ class AwsUtil(object):
def gen_env_tag(env):
"""Generate the environment tag
"""
- return "tag_environment_%s" % env
+ return "tag_env_%s" % env
def gen_host_type_tag(self, host_type):
"""Generate the host type tag
diff --git a/bin/oscp b/bin/oscp
index 89e90a36a..c79fc8785 100755
--- a/bin/oscp
+++ b/bin/oscp
@@ -138,7 +138,7 @@ class Oscp(object):
# attempt to select the correct environment if specified
if self.env:
- results = filter(lambda result: result[1]['ec2_tag_environment'] == self.env, results)
+ results = filter(lambda result: result[1]['ec2_tag_env'] == self.env, results)
if results:
return results
@@ -167,7 +167,7 @@ class Oscp(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_env:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
if limit:
print
@@ -180,7 +180,7 @@ class Oscp(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_env:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
def scp(self):
'''scp files to or from a specified host
@@ -209,7 +209,7 @@ class Oscp(object):
if len(results) > 1:
print "Multiple results found for %s." % self.host
for result in results:
- print "{ec2_tag_Name:<35} {ec2_tag_environment:<5} {ec2_id:<10}".format(**result[1])
+ print "{ec2_tag_Name:<35} {ec2_tag_env:<5} {ec2_id:<10}".format(**result[1])
return # early exit, too many results
# Assume we have one and only one.
diff --git a/bin/ossh b/bin/ossh
index b6738ee76..50fa996c3 100755
--- a/bin/ossh
+++ b/bin/ossh
@@ -127,7 +127,7 @@ class Ossh(object):
# attempt to select the correct environment if specified
if self.env:
- results = filter(lambda result: result[1]['ec2_tag_environment'] == self.env, results)
+ results = filter(lambda result: result[1]['ec2_tag_env'] == self.env, results)
if results:
return results
@@ -156,7 +156,7 @@ class Ossh(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_env:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
if limit:
print
@@ -169,7 +169,7 @@ class Ossh(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_env:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
def ssh(self):
'''SSH to a specified host
@@ -195,7 +195,7 @@ class Ossh(object):
if len(results) > 1:
print "Multiple results found for %s." % self.host
for result in results:
- print "{ec2_tag_Name:<35} {ec2_tag_environment:<5} {ec2_id:<10}".format(**result[1])
+ print "{ec2_tag_Name:<35} {ec2_tag_env:<5} {ec2_id:<10}".format(**result[1])
return # early exit, too many results
# Assume we have one and only one.
diff --git a/bin/ossh_bash_completion b/bin/ossh_bash_completion
index 997ff0f9c..440fa0a45 100755
--- a/bin/ossh_bash_completion
+++ b/bin/ossh_bash_completion
@@ -1,12 +1,12 @@
__ossh_known_hosts(){
if python -c 'import openshift_ansible' &>/dev/null; then
- /usr/bin/python -c 'from openshift_ansible import multi_inventory; m=multi_inventory.MultiInventory(); m.run(); z=m.result; print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])'
+ /usr/bin/python -c 'from openshift_ansible import multi_inventory; m=multi_inventory.MultiInventory(); m.run(); z=m.result; print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])'
elif [[ -f /dev/shm/.ansible/tmp/multi_inventory.cache ]]; then
- /usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])'
+ /usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])'
elif [[ -f ~/.ansible/tmp/multi_inventory.cache ]]; then
- /usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("~/.ansible/tmp/multi_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])'
+ /usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("~/.ansible/tmp/multi_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])'
fi
}
diff --git a/bin/ossh_zsh_completion b/bin/ossh_zsh_completion
index 3c4018636..f9454357b 100644
--- a/bin/ossh_zsh_completion
+++ b/bin/ossh_zsh_completion
@@ -2,13 +2,13 @@
_ossh_known_hosts(){
if python -c 'import openshift_ansible' &>/dev/null; then
- print $(/usr/bin/python -c 'from openshift_ansible import multi_inventory; m=multi_inventory.MultiInventory(); m.run(); z=m.result; print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])')
+ print $(/usr/bin/python -c 'from openshift_ansible import multi_inventory; m=multi_inventory.MultiInventory(); m.run(); z=m.result; print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])')
elif [[ -f /dev/shm/.ansible/tmp/multi_inventory.cache ]]; then
- print $(/usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])')
+ print $(/usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])')
elif [[ -f ~/.ansible/tmp/multi_inventory.cache ]]; then
- print $(/usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("~/.ansible/tmp/multi_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])')
+ print $(/usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("~/.ansible/tmp/multi_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_env"))])')
fi
diff --git a/bin/zsh_functions/_ossh b/bin/zsh_functions/_ossh
index d205e1055..e34ca5bd4 100644
--- a/bin/zsh_functions/_ossh
+++ b/bin/zsh_functions/_ossh
@@ -2,7 +2,7 @@
_ossh_known_hosts(){
if [[ -f ~/.ansible/tmp/multi_inventory.cache ]]; then
- print $(/usr/bin/python -c 'import json,os; z = json.loads(open("%s"%os.path.expanduser("~/.ansible/tmp/multi_inventory.cache")).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items()])')
+ print $(/usr/bin/python -c 'import json,os; z = json.loads(open("%s"%os.path.expanduser("~/.ansible/tmp/multi_inventory.cache")).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_env"]) for dns, host in z["_meta"]["hostvars"].items()])')
fi
}
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 1a854f637..48e27a24a 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -433,6 +433,7 @@ class FilterModule(object):
'''
for tag in tags:
# Skip tag_env-host-type to avoid ambiguity with tag_env
+ # Removing env-host-type tag but leaving this here
if tag[:17] == 'tag_env-host-type':
continue
if tag[:len(key)+4] == 'tag_' + key:
diff --git a/playbooks/adhoc/create_pv/create_pv.yaml b/playbooks/adhoc/create_pv/create_pv.yaml
index e4eb5da49..0ca040ee1 100644
--- a/playbooks/adhoc/create_pv/create_pv.yaml
+++ b/playbooks/adhoc/create_pv/create_pv.yaml
@@ -3,9 +3,9 @@
# ansible-playbook -e "cli_volume_size=1" \
# -e "cli_device_name=/dev/xvdf" \
# -e "cli_hosttype=master" \
-# -e "cli_environment=ops" \
+# -e "cli_env=ops" \
# create_pv.yaml
-# FIXME: we need to change "environment" to "clusterid" as that's what it really is now.
+# FIXME: we need to change "env" to "clusterid" as that's what it really is now.
#
- name: Create a volume and attach it to master
hosts: localhost
@@ -16,7 +16,7 @@
cli_volume_type: gp2
cli_volume_iops: ''
oo_name: "{{ groups['tag_host-type_' ~ cli_hosttype] |
- intersect(groups['tag_environment_' ~ cli_environment]) |
+ intersect(groups['tag_env_' ~ cli_env]) |
first }}"
pre_tasks:
- fail:
@@ -26,7 +26,7 @@
- cli_volume_size
- cli_device_name
- cli_hosttype
- - cli_environment
+ - cli_env
- name: set oo_name fact
set_fact:
@@ -57,7 +57,7 @@
args:
tags:
Name: "pv-{{ hostvars[oo_name]['ec2_tag_Name'] }}"
- env: "{{cli_environment}}"
+ env: "{{cli_env}}"
register: voltags
- debug: var=voltags
diff --git a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
index b6a2d2f26..89128dd3c 100644
--- a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
+++ b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
@@ -113,7 +113,7 @@
args:
tags:
Name: "{{ ec2_tag_Name }}"
- env: "{{ ec2_tag_environment }}"
+ env: "{{ ec2_tag_env}}"
register: voltags
- name: Wait for volume to attach
diff --git a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
index 63d473146..b4bcb25da 100644
--- a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
+++ b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
@@ -151,7 +151,7 @@
args:
tags:
Name: "{{ ec2_tag_Name }}"
- env: "{{ ec2_tag_environment }}"
+ env: "{{ ec2_tag_env }}"
register: voltags
- name: check for attached drive
diff --git a/playbooks/adhoc/s3_registry/s3_registry.yml b/playbooks/adhoc/s3_registry/s3_registry.yml
index 4dcef1a42..071c2cf46 100644
--- a/playbooks/adhoc/s3_registry/s3_registry.yml
+++ b/playbooks/adhoc/s3_registry/s3_registry.yml
@@ -6,7 +6,7 @@
# The AWS access/secret keys should be the keys of a separate user (not your main user), containing only the necessary S3 access role.
# The 'clusterid' is the short name of your cluster.
-- hosts: tag_env-host-type_{{ clusterid }}-openshift-master
+- hosts: tag_env_{{ clusterid }}:&tag_host-type_openshift-master
remote_user: root
gather_facts: False
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index 4f395f754..50fe42d6c 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -12,10 +12,10 @@
- include: ../../common/openshift-cluster/config.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
- g_nodes_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-node' }}"
+ 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_node_hosts: "{{ (groups['tag_host-type_node']|default([])) | intersect((groups['tag_env_' ~ cluster_id]|default([]))) }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
g_nodeonmaster: true
diff --git a/playbooks/aws/openshift-cluster/scaleup.yml b/playbooks/aws/openshift-cluster/scaleup.yml
index 7c91cf035..9c9118286 100644
--- a/playbooks/aws/openshift-cluster/scaleup.yml
+++ b/playbooks/aws/openshift-cluster/scaleup.yml
@@ -22,10 +22,10 @@
- include: ../../common/openshift-cluster/scaleup.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
- g_new_nodes_group: 'nodes_to_add'
+ 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_new_node_hosts: "{{ groups.nodes_to_add }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
g_nodeonmaster: true
diff --git a/playbooks/aws/openshift-cluster/service.yml b/playbooks/aws/openshift-cluster/service.yml
index cca6f9f5b..ce0992a45 100644
--- a/playbooks/aws/openshift-cluster/service.yml
+++ b/playbooks/aws/openshift-cluster/service.yml
@@ -16,7 +16,7 @@
groups: g_service_masters
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- name: Evaluate g_service_nodes
add_host:
@@ -24,7 +24,7 @@
groups: g_service_nodes
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([])
+ with_items: "{{ g_node_hosts | default([]) }}"
- include: ../../common/openshift-node/service.yml
- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
index 99f0577fc..1fbd71a75 100644
--- a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
@@ -3,7 +3,6 @@
created_by: "{{ lookup('env', 'LOGNAME')|default(cluster, true) }}"
docker_vol_ephemeral: "{{ lookup('env', 'os_docker_vol_ephemeral') | default(false, true) }}"
env: "{{ cluster }}"
- env_host_type: "{{ cluster }}-openshift-{{ type }}"
host_type: "{{ type }}"
sub_host_type: "{{ g_sub_host_type }}"
@@ -124,10 +123,8 @@
wait: yes
instance_tags:
created-by: "{{ created_by }}"
- environment: "{{ env }}"
env: "{{ env }}"
host-type: "{{ host_type }}"
- env-host-type: "{{ env_host_type }}"
sub-host-type: "{{ sub_host_type }}"
volumes: "{{ volumes }}"
register: ec2
@@ -142,9 +139,7 @@
Name: "{{ item.0 }}"
- set_fact:
- instance_groups: "tag_created-by_{{ created_by }}, tag_env_{{ env }},
- tag_host-type_{{ host_type }}, tag_env-host-type_{{ env_host_type }},
- tag_sub-host-type_{{ sub_host_type }}"
+ instance_groups: "tag_created-by_{{ created_by }}, tag_env_{{ env }}, tag_host-type_{{ host_type }}, tag_sub-host-type_{{ sub_host_type }}"
- set_fact:
node_label:
diff --git a/playbooks/aws/openshift-cluster/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml
index 9f00358f5..aafd40c43 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/openshift-cluster/terminate.yml
@@ -39,7 +39,6 @@
tags:
env: "{{ item['ec2_tag_env'] }}"
host-type: "{{ item['ec2_tag_host-type'] }}"
- env-host-type: "{{ item['ec2_tag_env-host-type'] }}"
sub_host_type: "{{ item['ec2_tag_sub-host-type'] }}"
with_items: host_vars
when: "'oo_hosts_to_terminate' in groups"
diff --git a/playbooks/aws/openshift-cluster/update.yml b/playbooks/aws/openshift-cluster/update.yml
index c154fdd6b..3df0c3f3a 100644
--- a/playbooks/aws/openshift-cluster/update.yml
+++ b/playbooks/aws/openshift-cluster/update.yml
@@ -1,21 +1,24 @@
---
-- name: Populate oo_hosts_to_update group
+- name: Update - Populate oo_hosts_to_update group
hosts: localhost
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
tasks:
- - name: Evaluate oo_hosts_to_update
+ - name: Update - Evaluate oo_hosts_to_update
add_host:
name: "{{ item }}"
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: (groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
index 8cad51b5e..20cc97c8a 100644
--- a/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+++ b/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -19,10 +19,10 @@
- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
- g_nodes_group: "{{ tmp_nodes_group | default('') }}"
+ 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_node_hosts: "{{ (groups['tag_host-type_node']|default([])) | intersect((groups['tag_env_' ~ cluster_id]|default([]))) }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
g_nodeonmaster: true
diff --git a/playbooks/byo/openshift-cluster/config.yml b/playbooks/byo/openshift-cluster/config.yml
index 411c7e660..ba8fe0a52 100644
--- a/playbooks/byo/openshift-cluster/config.yml
+++ b/playbooks/byo/openshift-cluster/config.yml
@@ -1,10 +1,10 @@
---
- include: ../../common/openshift-cluster/config.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_node_hosts: "{{ groups.nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_debug_level: 2
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/scaleup.yml b/playbooks/byo/openshift-cluster/scaleup.yml
index 70644d427..8f8ef6f21 100644
--- a/playbooks/byo/openshift-cluster/scaleup.yml
+++ b/playbooks/byo/openshift-cluster/scaleup.yml
@@ -1,10 +1,10 @@
---
- include: ../../common/openshift-cluster/scaleup.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_new_nodes_group: "{{ 'new_nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_new_node_hosts: "{{ groups.new_nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_debug_level: 2
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
index 76fa9ba22..56e79e8c2 100644
--- a/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+++ b/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
@@ -1,9 +1,9 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_node_hosts: "{{ groups.nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
index b06442366..b4b4f3ec0 100644
--- a/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+++ b/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -1,9 +1,9 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_node_hosts: "{{ groups.nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml
index 7613b287e..6343a2567 100644
--- a/playbooks/common/openshift-cluster/evaluate_groups.yml
+++ b/playbooks/common/openshift-cluster/evaluate_groups.yml
@@ -6,20 +6,20 @@
gather_facts: no
tasks:
- fail:
- msg: This playbook requires g_etcd_group to be set
- when: g_etcd_group is not defined
+ msg: This playbook requires g_etcd_hosts to be set
+ when: g_etcd_hosts is not defined
- fail:
- msg: This playbook requires g_masters_group to be set
- when: g_masters_group is not defined
+ msg: This playbook requires g_master_hosts to be set
+ when: g_master_hosts is not defined
- fail:
- msg: This playbook requires g_nodes_group or g_new_nodes_group to be set
- when: g_nodes_group is not defined and g_new_nodes_group is not defined
+ msg: This playbook requires g_node_hosts or g_new_node_hosts to be set
+ when: g_node_hosts is not defined and g_new_node_hosts is not defined
- fail:
- msg: This playbook requires g_lb_group to be set
- when: g_lb_group is not defined
+ msg: This playbook requires g_lb_hosts to be set
+ when: g_lb_hosts is not defined
- name: Evaluate oo_etcd_to_config
add_host:
@@ -27,7 +27,7 @@
groups: oo_etcd_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_etcd_group] | default([])
+ with_items: "{{ g_etcd_hosts | default([]) }}"
- name: Evaluate oo_masters_to_config
add_host:
@@ -35,11 +35,11 @@
groups: oo_masters_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_masters_group] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- # Use g_new_nodes_group if it exists otherwise g_nodes_group
+ # Use g_new_node_hosts if it exists otherwise g_node_hosts
- set_fact:
- g_nodes_to_config: "{{ g_new_nodes_group | default(g_nodes_group | default([])) }}"
+ g_node_hosts_to_config: "{{ g_new_node_hosts | default(g_node_hosts | default([])) }}"
- name: Evaluate oo_nodes_to_config
add_host:
@@ -47,32 +47,32 @@
groups: oo_nodes_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_nodes_to_config] | default([])
+ with_items: "{{ g_node_hosts_to_config | default([]) }}"
- # Skip adding the master to oo_nodes_to_config when g_new_nodes_group is
+ # Skip adding the master to oo_nodes_to_config when g_new_node_hosts is
- name: Evaluate oo_nodes_to_config
add_host:
name: "{{ item }}"
groups: oo_nodes_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_masters_group] | default([])
- when: g_nodeonmaster | default(false) == true and g_new_nodes_group is not defined
+ with_items: "{{ g_master_hosts | default([]) }}"
+ when: g_nodeonmaster | default(false) == true and g_new_node_hosts is not defined
- name: Evaluate oo_first_etcd
add_host:
- name: "{{ groups[g_etcd_group][0] }}"
+ name: "{{ g_etcd_hosts[0] }}"
groups: oo_first_etcd
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
- when: g_etcd_group in groups and (groups[g_etcd_group] | length) > 0
+ when: g_etcd_hosts|length > 0
- name: Evaluate oo_first_master
add_host:
- name: "{{ groups[g_masters_group][0] }}"
+ name: "{{ g_master_hosts[0] }}"
groups: oo_first_master
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- when: g_masters_group in groups and (groups[g_masters_group] | length) > 0
+ when: g_master_hosts|length > 0
- name: Evaluate oo_lb_to_config
add_host:
@@ -80,4 +80,4 @@
groups: oo_lb_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_lb_group] | default([])
+ with_items: "{{ g_lb_hosts | default([]) }}"
diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml
index 2a85d29dd..5bf98c2d5 100644
--- a/playbooks/gce/openshift-cluster/config.yml
+++ b/playbooks/gce/openshift-cluster/config.yml
@@ -17,10 +17,10 @@
- include: ../../common/openshift-cluster/config.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-master' }}"
- g_nodes_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-node' }}"
+ 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_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
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 386628e8c..ab593b897 100644
--- a/playbooks/gce/openshift-cluster/join_node.yml
+++ b/playbooks/gce/openshift-cluster/join_node.yml
@@ -4,6 +4,11 @@
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
tasks:
@@ -33,11 +38,11 @@
- name: Evaluate oo_first_master
add_host:
- name: "{{ groups['tag_env-host-type-' ~ cluster_id ~ '-openshift-master'][0] }}"
+ name: "{{ g_master_hosts | first }}"
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: oo_first_master
- when: "'tag_env-host-type-{{ cluster_id }}-openshift-master' in groups"
+ when: g_master_hosts is defined and g_master_hosts|length > 0
#- include: config.yml
- include: ../../common/openshift-node/config.yml
diff --git a/playbooks/gce/openshift-cluster/service.yml b/playbooks/gce/openshift-cluster/service.yml
index 4bf5c8131..337ba7e44 100644
--- a/playbooks/gce/openshift-cluster/service.yml
+++ b/playbooks/gce/openshift-cluster/service.yml
@@ -10,21 +10,19 @@
- fail: msg="cluster_id is required to be injected in this playbook"
when: cluster_id is not defined
- - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-node
- add_host:
name: "{{ item }}"
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: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
+ with_items: "{{ g_node_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
- - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-master
- 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: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
+ with_items: "{{ g_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 de8a75b18..2360a3263 100644
--- a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
@@ -19,7 +19,6 @@
- env-{{ cluster }}
- host-type-{{ type }}
- sub-host-type-{{ g_sub_host_type }}
- - env-host-type-{{ cluster }}-openshift-{{ type }}
when: instances |length > 0
register: gce
diff --git a/playbooks/gce/openshift-cluster/update.yml b/playbooks/gce/openshift-cluster/update.yml
index 50958284d..d60662397 100644
--- a/playbooks/gce/openshift-cluster/update.yml
+++ b/playbooks/gce/openshift-cluster/update.yml
@@ -4,6 +4,11 @@
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
tasks:
@@ -13,9 +18,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: (groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/gce/openshift-cluster/wip.yml b/playbooks/gce/openshift-cluster/wip.yml
index 34cef52bc..0e3757546 100644
--- a/playbooks/gce/openshift-cluster/wip.yml
+++ b/playbooks/gce/openshift-cluster/wip.yml
@@ -13,7 +13,7 @@
groups: oo_masters_for_deploy
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- name: Deploy OpenShift Services
hosts: oo_masters_for_deploy
diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index 9bccf80b9..b84bde084 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -16,10 +16,10 @@
- include: ../../common/openshift-cluster/config.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-master' }}"
- g_nodes_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-node' }}"
+ 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_node_hosts: "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
openshift_cluster_id: "{{ cluster_id }}"
diff --git a/playbooks/libvirt/openshift-cluster/service.yml b/playbooks/libvirt/openshift-cluster/service.yml
index aabd2566d..cd07c8701 100644
--- a/playbooks/libvirt/openshift-cluster/service.yml
+++ b/playbooks/libvirt/openshift-cluster/service.yml
@@ -20,7 +20,7 @@
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: g_service_masters
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- name: Evaluate g_service_nodes
add_host:
@@ -28,7 +28,7 @@
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: g_service_nodes
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([])
+ with_items: "{{ g_node_hosts | default([]) }}"
- include: ../../common/openshift-node/service.yml
- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index f26b41f31..ae8275ef6 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -88,7 +88,7 @@
ansible_ssh_host: '{{ item.1 }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env-{{ cluster }}, tag_host-type-{{ type }}, tag_env-host-type-{{ cluster }}-openshift-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}'
+ groups: 'tag_env-{{ cluster }}, tag_host-type-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}'
with_together:
- instances
- ips
diff --git a/playbooks/libvirt/openshift-cluster/templates/domain.xml b/playbooks/libvirt/openshift-cluster/templates/domain.xml
index 870bcf2a6..c4ac6a434 100644
--- a/playbooks/libvirt/openshift-cluster/templates/domain.xml
+++ b/playbooks/libvirt/openshift-cluster/templates/domain.xml
@@ -4,7 +4,6 @@
<metadata xmlns:ansible="https://github.com/ansible/ansible">
<ansible:tags>
<ansible:tag>env-{{ cluster }}</ansible:tag>
- <ansible:tag>env-host-type-{{ cluster }}-openshift-{{ type }}</ansible:tag>
<ansible:tag>host-type-{{ type }}</ansible:tag>
<ansible:tag>sub-host-type-{{ g_sub_host_type }}</ansible:tag>
</ansible:tags>
diff --git a/playbooks/libvirt/openshift-cluster/update.yml b/playbooks/libvirt/openshift-cluster/update.yml
index dde67bcb1..5e2bd3a3d 100644
--- a/playbooks/libvirt/openshift-cluster/update.yml
+++ b/playbooks/libvirt/openshift-cluster/update.yml
@@ -4,6 +4,12 @@
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
tasks:
@@ -13,9 +19,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: (groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/openstack/openshift-cluster/config.yml b/playbooks/openstack/openshift-cluster/config.yml
index ad68e8701..da7b5cc49 100644
--- a/playbooks/openstack/openshift-cluster/config.yml
+++ b/playbooks/openstack/openshift-cluster/config.yml
@@ -11,10 +11,10 @@
- include: ../../common/openshift-cluster/config.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
- g_nodes_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-node' }}"
+ 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_node_hosts: "{{ (groups['tag_host-type_node']|default([])) | intersect((groups['tag_env_' ~ cluster_id]|default([]))) }}"
g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
openshift_cluster_id: "{{ cluster_id }}"
diff --git a/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml b/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
index 9dcab3e60..3f24a3e45 100644
--- a/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
+++ b/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
@@ -107,12 +107,6 @@ resources:
metadata:
env: { get_param: cluster_id }
host-type: { get_param: type }
- env-host-type:
- str_replace:
- template: cluster_id-openshift-type
- params:
- cluster_id: { get_param: cluster_id }
- type: { get_param: type }
sub-host-type: { get_param: subtype }
port:
diff --git a/playbooks/openstack/openshift-cluster/launch.yml b/playbooks/openstack/openshift-cluster/launch.yml
index d2f563274..876ca595a 100644
--- a/playbooks/openstack/openshift-cluster/launch.yml
+++ b/playbooks/openstack/openshift-cluster/launch.yml
@@ -71,7 +71,7 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_etcd, tag_env-host-type_{{ cluster_id }}-openshift-etcd, tag_sub-host-type_default'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_etcd, tag_sub-host-type_default'
with_together:
- parsed_outputs.etcd_names
- parsed_outputs.etcd_ips
@@ -83,7 +83,7 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_master, tag_env-host-type_{{ cluster_id }}-openshift-master, tag_sub-host-type_default'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_master, tag_sub-host-type_default'
with_together:
- parsed_outputs.master_names
- parsed_outputs.master_ips
@@ -95,7 +95,7 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_compute'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_sub-host-type_compute'
with_together:
- parsed_outputs.node_names
- parsed_outputs.node_ips
@@ -107,7 +107,7 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_infra'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_sub-host-type_infra'
with_together:
- parsed_outputs.infra_names
- parsed_outputs.infra_ips
diff --git a/playbooks/openstack/openshift-cluster/update.yml b/playbooks/openstack/openshift-cluster/update.yml
index b4dd324a6..4ecf75a5d 100644
--- a/playbooks/openstack/openshift-cluster/update.yml
+++ b/playbooks/openstack/openshift-cluster/update.yml
@@ -4,6 +4,12 @@
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
tasks:
@@ -13,9 +19,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: (groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml