summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/cluster106
-rw-r--r--bin/openshift_ansible/awsutil.py18
-rw-r--r--inventory/byo/hosts.aep.example3
-rw-r--r--inventory/byo/hosts.aep_quickstart20
-rw-r--r--inventory/byo/hosts.openstack37
-rw-r--r--inventory/byo/hosts.origin.example3
-rw-r--r--inventory/byo/hosts.ose.example3
-rw-r--r--playbooks/adhoc/create_pv/create_pv.yaml9
-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/adhoc/setupnfs.yml21
-rw-r--r--playbooks/aws/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/aws/openshift-cluster/config.yml25
-rw-r--r--playbooks/aws/openshift-cluster/list.yml2
-rw-r--r--playbooks/aws/openshift-cluster/scaleup.yml15
-rw-r--r--playbooks/aws/openshift-cluster/service.yml5
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml9
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml34
-rw-r--r--playbooks/aws/openshift-cluster/update.yml8
-rw-r--r--playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml28
-rw-r--r--playbooks/aws/openshift-cluster/vars.yml1
-rw-r--r--playbooks/byo/openshift-cluster/cluster_hosts.yml13
-rw-r--r--playbooks/byo/openshift-cluster/config.yml9
-rw-r--r--playbooks/byo/openshift-cluster/scaleup.yml8
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/README.md2
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml2
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml2
-rw-r--r--playbooks/gce/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/gce/openshift-cluster/config.yml31
-rw-r--r--playbooks/gce/openshift-cluster/join_node.yml11
-rw-r--r--playbooks/gce/openshift-cluster/list.yml2
-rw-r--r--playbooks/gce/openshift-cluster/service.yml5
-rw-r--r--playbooks/gce/openshift-cluster/tasks/launch_instances.yml3
-rw-r--r--playbooks/gce/openshift-cluster/terminate.yml3
-rw-r--r--playbooks/gce/openshift-cluster/update.yml10
-rw-r--r--playbooks/gce/openshift-cluster/vars.yml3
-rw-r--r--playbooks/libvirt/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/libvirt/openshift-cluster/config.yml27
-rw-r--r--playbooks/libvirt/openshift-cluster/list.yml2
-rw-r--r--playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml2
-rw-r--r--playbooks/libvirt/openshift-cluster/templates/domain.xml3
-rw-r--r--playbooks/libvirt/openshift-cluster/terminate.yml2
-rw-r--r--playbooks/libvirt/openshift-cluster/update.yml11
-rw-r--r--playbooks/libvirt/openshift-cluster/vars.yml1
-rw-r--r--playbooks/openstack/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/openstack/openshift-cluster/config.yml27
-rw-r--r--playbooks/openstack/openshift-cluster/launch.yml8
-rw-r--r--playbooks/openstack/openshift-cluster/list.yml2
-rw-r--r--playbooks/openstack/openshift-cluster/terminate.yml3
-rw-r--r--playbooks/openstack/openshift-cluster/update.yml11
-rw-r--r--playbooks/openstack/openshift-cluster/vars.yml1
52 files changed, 378 insertions, 267 deletions
diff --git a/bin/cluster b/bin/cluster
index 9b02b4347..3081ebd4a 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -55,94 +55,108 @@ class Cluster(object):
Create an OpenShift cluster for given provider
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
+ cluster = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
playbook = "playbooks/{0}/openshift-cluster/launch.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- env['num_masters'] = args.masters
- env['num_nodes'] = args.nodes
- env['num_infra'] = args.infra
- env['num_etcd'] = args.etcd
+ cluster['num_masters'] = args.masters
+ cluster['num_nodes'] = args.nodes
+ cluster['num_infra'] = args.infra
+ cluster['num_etcd'] = args.etcd
+ cluster['cluster_env'] = args.env
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def addNodes(self, args):
"""
Add nodes to an existing cluster for given provider
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args)}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ }
playbook = "playbooks/{0}/openshift-cluster/addNodes.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- env['num_nodes'] = args.nodes
- env['num_infra'] = args.infra
+ cluster['num_nodes'] = args.nodes
+ cluster['num_infra'] = args.infra
+ cluster['cluster_env'] = args.env
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def terminate(self, args):
"""
Destroy OpenShift cluster
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args)}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ 'cluster_env': args.env,
+ }
playbook = "playbooks/{0}/openshift-cluster/terminate.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def list(self, args):
"""
List VMs in cluster
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args)}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ 'cluster_env': args.env,
+ }
playbook = "playbooks/{0}/openshift-cluster/list.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def config(self, args):
"""
Configure or reconfigure OpenShift across clustered VMs
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args)}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ 'cluster_env': args.env,
+ }
playbook = "playbooks/{0}/openshift-cluster/config.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def update(self, args):
"""
Update to latest OpenShift across clustered VMs
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args)}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ 'cluster_env': args.env,
+ }
+
playbook = "playbooks/{0}/openshift-cluster/update.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def service(self, args):
"""
Make the same service call across all nodes in the cluster
:param args: command line arguments provided by user
"""
- env = {'cluster_id': args.cluster_id,
- 'deployment_type': self.get_deployment_type(args),
- 'new_cluster_state': args.state}
+ cluster = {'cluster_id': args.cluster_id,
+ 'deployment_type': self.get_deployment_type(args),
+ 'new_cluster_state': args.state,
+ 'cluster_env': args.env,
+ }
playbook = "playbooks/{0}/openshift-cluster/service.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- self.action(args, inventory, env, playbook)
+ self.action(args, inventory, cluster, playbook)
def setup_provider(self, provider):
"""
@@ -152,10 +166,9 @@ class Cluster(object):
"""
config = ConfigParser.ConfigParser()
if 'gce' == provider:
- gce_ini_default_path = os.path.join(
- 'inventory/gce/hosts/gce.ini')
+ gce_ini_default_path = os.path.join('inventory/gce/hosts/gce.ini')
gce_ini_path = os.environ.get('GCE_INI_PATH', gce_ini_default_path)
- if os.path.exists(gce_ini_path):
+ if os.path.exists(gce_ini_path):
config.readfp(open(gce_ini_path))
for key in config.options('gce'):
@@ -190,12 +203,12 @@ class Cluster(object):
return inventory
- def action(self, args, inventory, env, playbook):
+ def action(self, args, inventory, cluster, playbook):
"""
Build ansible-playbook command line and execute
:param args: command line arguments provided by user
:param inventory: derived provider library
- :param env: environment variables for kubernetes
+ :param cluster: cluster variables for kubernetes
:param playbook: ansible playbook to execute
"""
@@ -206,14 +219,14 @@ class Cluster(object):
if args.option:
for opt in args.option:
k, v = opt.split('=', 1)
- env['cli_' + k] = v
+ cluster['cli_' + k] = v
- ansible_env = '-e \'{0}\''.format(
- ' '.join(['%s=%s' % (key, value) for (key, value) in env.items()])
+ ansible_extra_vars = '-e \'{0}\''.format(
+ ' '.join(['%s=%s' % (key, value) for (key, value) in cluster.items()])
)
command = 'ansible-playbook {0} {1} {2} {3}'.format(
- verbose, inventory, ansible_env, playbook
+ verbose, inventory, ansible_extra_vars, playbook
)
if args.profile:
@@ -242,7 +255,7 @@ class ActionFailed(Exception):
if __name__ == '__main__':
"""
- User command to invoke ansible playbooks in a "known" environment
+ User command to invoke ansible playbooks in a "known" configuration
Reads ~/.openshift-ansible for default configuration items
[DEFAULT]
@@ -251,7 +264,7 @@ if __name__ == '__main__':
providers = gce,aws,libvirt,openstack
"""
- environment = ConfigParser.SafeConfigParser({
+ cluster_config = ConfigParser.SafeConfigParser({
'cluster_ids': 'marketing,sales',
'validate_cluster_ids': 'False',
'providers': 'gce,aws,libvirt,openstack',
@@ -259,23 +272,23 @@ if __name__ == '__main__':
path = os.path.expanduser("~/.openshift-ansible")
if os.path.isfile(path):
- environment.read(path)
+ cluster_config.read(path)
cluster = Cluster()
parser = argparse.ArgumentParser(
- description='Python wrapper to ensure proper environment for OpenShift ansible playbooks',
+ description='Python wrapper to ensure proper configuration for OpenShift ansible playbooks',
)
parser.add_argument('-v', '--verbose', action='count',
help='Multiple -v options increase the verbosity')
parser.add_argument('--version', action='version', version='%(prog)s 0.3')
meta_parser = argparse.ArgumentParser(add_help=False)
- providers = environment.get('DEFAULT', 'providers').split(',')
+ providers = cluster_config.get('DEFAULT', 'providers').split(',')
meta_parser.add_argument('provider', choices=providers, help='provider')
- if environment.get('DEFAULT', 'validate_cluster_ids').lower() in ("yes", "true", "1"):
- meta_parser.add_argument('cluster_id', choices=environment.get('DEFAULT', 'cluster_ids').split(','),
+ if cluster_config.get('DEFAULT', 'validate_cluster_ids').lower() in ("yes", "true", "1"):
+ meta_parser.add_argument('cluster_id', choices=cluster_config.get('DEFAULT', 'cluster_ids').split(','),
help='prefix for cluster VM names')
else:
meta_parser.add_argument('cluster_id', help='prefix for cluster VM names')
@@ -289,6 +302,9 @@ if __name__ == '__main__':
meta_parser.add_argument('-o', '--option', action='append',
help='options')
+ meta_parser.add_argument('--env', default='dev', type=str,
+ help='environment for the cluster. Defaults to \'dev\'.')
+
meta_parser.add_argument('-p', '--profile', action='store_true',
help='Enable playbook profiling')
@@ -350,14 +366,14 @@ if __name__ == '__main__':
args = parser.parse_args()
if 'terminate' == args.action and not args.force:
- answer = raw_input("This will destroy the ENTIRE {0} environment. Are you sure? [y/N] ".format(args.cluster_id))
+ answer = raw_input("This will destroy the ENTIRE {0} cluster. Are you sure? [y/N] ".format(args.cluster_id))
if answer not in ['y', 'Y']:
sys.stderr.write('\nACTION [terminate] aborted by user!\n')
exit(1)
if 'update' == args.action and not args.force:
answer = raw_input(
- "This is destructive and could corrupt {0} environment. Continue? [y/N] ".format(args.cluster_id))
+ "This is destructive and could corrupt {0} cluster. Continue? [y/N] ".format(args.cluster_id))
if answer not in ['y', 'Y']:
sys.stderr.write('\nACTION [update] aborted by user!\n')
exit(1)
diff --git a/bin/openshift_ansible/awsutil.py b/bin/openshift_ansible/awsutil.py
index 1ea2f914c..76b4f4f51 100644
--- a/bin/openshift_ansible/awsutil.py
+++ b/bin/openshift_ansible/awsutil.py
@@ -61,7 +61,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_env_(.*)')
+ pattern = re.compile(r'^tag_environment_(.*)')
envs = []
inv = self.get_inventory()
@@ -109,13 +109,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_env' not in host:
+ if 'ec2_tag_environment' not in host:
continue
- if host['ec2_tag_env'] not in inst_by_env:
- inst_by_env[host['ec2_tag_env']] = {}
+ if host['ec2_tag_environment'] not in inst_by_env:
+ inst_by_env[host['ec2_tag_environment']] = {}
host_id = "%s:%s" % (host['ec2_tag_Name'], host['ec2_id'])
- inst_by_env[host['ec2_tag_env']][host_id] = host
+ inst_by_env[host['ec2_tag_environment']][host_id] = host
return inst_by_env
@@ -157,7 +157,7 @@ class AwsUtil(object):
def gen_env_tag(env):
"""Generate the environment tag
"""
- return "tag_env_%s" % env
+ return "tag_environment_%s" % env
def gen_host_type_tag(self, host_type):
"""Generate the host type tag
@@ -165,12 +165,6 @@ class AwsUtil(object):
host_type = self.resolve_host_type(host_type)
return "tag_host-type_%s" % host_type
- def gen_env_host_type_tag(self, host_type, env):
- """Generate the environment host type tag
- """
- host_type = self.resolve_host_type(host_type)
- return "tag_env-host-type_%s-%s" % (env, host_type)
-
def get_host_list(self, host_type=None, envs=None, version=None, cached=False):
"""Get the list of hosts from the inventory using host-type and environment
"""
diff --git a/inventory/byo/hosts.aep.example b/inventory/byo/hosts.aep.example
index e7e7aedfd..5c901fd2e 100644
--- a/inventory/byo/hosts.aep.example
+++ b/inventory/byo/hosts.aep.example
@@ -18,6 +18,9 @@ ansible_ssh_user=root
# user must be configured for passwordless sudo
#ansible_sudo=true
+# Debug level for all Atomic Enterprise components (Defaults to 2)
+debug_level=2
+
# deployment type valid values are origin, online, atomic-enterprise, and openshift-enterprise
deployment_type=atomic-enterprise
diff --git a/inventory/byo/hosts.aep_quickstart b/inventory/byo/hosts.aep_quickstart
new file mode 100644
index 000000000..46ea3a03f
--- /dev/null
+++ b/inventory/byo/hosts.aep_quickstart
@@ -0,0 +1,20 @@
+[OSEv3:children]
+masters
+nodes
+etcd
+lb
+
+[OSEv3:vars]
+ansible_ssh_user=root
+deployment_type=atomic-enterprise
+osm_use_cockpit=true
+
+[masters]
+ose3-master.example.com
+
+[nodes]
+ose3-master.example.com openshift_scheduleable=True
+
+[etcd]
+
+[lb]
diff --git a/inventory/byo/hosts.openstack b/inventory/byo/hosts.openstack
new file mode 100644
index 000000000..05df75c2f
--- /dev/null
+++ b/inventory/byo/hosts.openstack
@@ -0,0 +1,37 @@
+# This is an example of a bring your own (byo) host inventory
+
+# Create an OSEv3 group that contains the masters and nodes groups
+[OSEv3:children]
+masters
+nodes
+etcd
+lb
+
+# Set variables common for all OSEv3 hosts
+[OSEv3:vars]
+ansible_ssh_user=cloud-user
+ansible_sudo=true
+
+# Debug level for all OpenShift components (Defaults to 2)
+debug_level=2
+
+deployment_type=openshift-enterprise
+
+openshift_additional_repos=[{'id': 'ose-3.1', 'name': 'ose-3.1', 'baseurl': 'http://pulp.dist.prod.ext.phx2.redhat.com/content/dist/rhel/server/7/7Server/x86_64/ose/3.1/os', 'enabled': 1, 'gpgcheck': 0}]
+
+openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '{{ openshift.common.config_base }}/htpasswd'}]
+
+#openshift_pkg_version=-3.0.0.0
+
+[masters]
+jdetiber-master.usersys.redhat.com openshift_public_hostname="{{ inventory_hostname }}" openshift_hostname="{{ ansible_default_ipv4.address }}"
+
+[etcd]
+jdetiber-etcd.usersys.redhat.com
+
+[lb]
+#ose3-lb-ansible.test.example.com
+
+[nodes]
+jdetiber-master.usersys.redhat.com openshift_public_hostname="{{ inventory_hostname }}" openshift_hostname="{{ ansible_default_ipv4.address }}"
+jdetiber-node[1:2].usersys.redhat.com openshift_public_hostname="{{ inventory_hostname }}" openshift_hostname="{{ ansible_default_ipv4.address }}" openshift_node_labels="{'region': 'primary', 'zone': 'default'}"
diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example
index ae9c94f04..990994570 100644
--- a/inventory/byo/hosts.origin.example
+++ b/inventory/byo/hosts.origin.example
@@ -19,6 +19,9 @@ ansible_ssh_user=root
# user must be configured for passwordless sudo
#ansible_sudo=true
+# Debug level for all OpenShift components (Defaults to 2)
+debug_level=2
+
# deployment type valid values are origin, online, atomic-enterprise and openshift-enterprise
deployment_type=origin
diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example
index 54864d195..5128c2111 100644
--- a/inventory/byo/hosts.ose.example
+++ b/inventory/byo/hosts.ose.example
@@ -18,6 +18,9 @@ ansible_ssh_user=root
# user must be configured for passwordless sudo
#ansible_sudo=true
+# Debug level for all OpenShift components (Defaults to 2)
+debug_level=2
+
# deployment type valid values are origin, online, atomic-enterprise, and openshift-enterprise
deployment_type=openshift-enterprise
diff --git a/playbooks/adhoc/create_pv/create_pv.yaml b/playbooks/adhoc/create_pv/create_pv.yaml
index 0ca040ee1..347d9f574 100644
--- a/playbooks/adhoc/create_pv/create_pv.yaml
+++ b/playbooks/adhoc/create_pv/create_pv.yaml
@@ -3,9 +3,8 @@
# ansible-playbook -e "cli_volume_size=1" \
# -e "cli_device_name=/dev/xvdf" \
# -e "cli_hosttype=master" \
-# -e "cli_env=ops" \
+# -e "cli_clusterid=ops" \
# create_pv.yaml
-# 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 +15,7 @@
cli_volume_type: gp2
cli_volume_iops: ''
oo_name: "{{ groups['tag_host-type_' ~ cli_hosttype] |
- intersect(groups['tag_env_' ~ cli_env]) |
+ intersect(groups['oo_clusterid_' ~ cli_clusterid]) |
first }}"
pre_tasks:
- fail:
@@ -26,7 +25,7 @@
- cli_volume_size
- cli_device_name
- cli_hosttype
- - cli_env
+ - cli_clusterid
- name: set oo_name fact
set_fact:
@@ -57,7 +56,7 @@
args:
tags:
Name: "pv-{{ hostvars[oo_name]['ec2_tag_Name'] }}"
- env: "{{cli_env}}"
+ clusterid: "{{cli_clusterid}}"
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 89128dd3c..4d32fc40b 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_env}}"
+ clusterid: "{{ ec2_tag_clusterid }}"
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 b4bcb25da..174cea460 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_env }}"
+ clusterid: "{{ ec2_tag_clusterid }}"
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 071c2cf46..d409b4086 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_{{ clusterid }}:&tag_host-type_openshift-master
+- hosts: tag_clusterid_{{ clusterid }}:&tag_host-type_openshift-master
remote_user: root
gather_facts: False
diff --git a/playbooks/adhoc/setupnfs.yml b/playbooks/adhoc/setupnfs.yml
new file mode 100644
index 000000000..5f3631fcf
--- /dev/null
+++ b/playbooks/adhoc/setupnfs.yml
@@ -0,0 +1,21 @@
+---
+### This playbook is old and we are currently not using NFS.
+- hosts: tag_Name_nfs-v3-stg
+ sudo: no
+ remote_user: root
+ gather_facts: no
+ roles:
+ - role: openshift_storage_nfs_lvm
+ mount_dir: /exports/stg-black
+ volume_prefix: "kwoodsontest"
+ volume_size: 5
+ volume_num_start: 222
+ number_of_volumes: 3
+ tasks:
+ - fetch:
+ dest: json/
+ src: /root/"{{ item }}"
+ with_items:
+ - persistent-volume.kwoodsontest5g0222.json
+ - persistent-volume.kwoodsontest5g0223.json
+ - persistent-volume.kwoodsontest5g0224.json
diff --git a/playbooks/aws/openshift-cluster/cluster_hosts.yml b/playbooks/aws/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..d6b413c6f
--- /dev/null
+++ b/playbooks/aws/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type_etcd']|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([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type_master']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|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_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([]) }}"
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index f46988432..abdb23d78 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -1,27 +1,14 @@
---
-- hosts: localhost
- gather_facts: no
- connection: local
- become: no
- vars_files:
- - vars.yml
- tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
-
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../aws/openshift-cluster/vars.yml
+ - ../../aws/openshift-cluster/cluster_hosts.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_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: "{{ ec2_private_ip_address }}"
openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/list.yml b/playbooks/aws/openshift-cluster/list.yml
index 8341ba9c1..8b41a355e 100644
--- a/playbooks/aws/openshift-cluster/list.yml
+++ b/playbooks/aws/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/aws/openshift-cluster/scaleup.yml b/playbooks/aws/openshift-cluster/scaleup.yml
index 9c9118286..c2135cd03 100644
--- a/playbooks/aws/openshift-cluster/scaleup.yml
+++ b/playbooks/aws/openshift-cluster/scaleup.yml
@@ -7,9 +7,6 @@
vars_files:
- vars.yml
tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
- name: Evaluate oo_hosts_to_update
add_host:
name: "{{ item }}"
@@ -21,16 +18,16 @@
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
- include: ../../common/openshift-cluster/scaleup.yml
+ vars_files:
+ - ../../aws/openshift-cluster/vars.yml
+ - ../../aws/openshift-cluster/cluster_hosts.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_new_node_hosts: "{{ groups.nodes_to_add }}"
- 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: "{{ ec2_private_ip_address }}"
openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/service.yml b/playbooks/aws/openshift-cluster/service.yml
index ce0992a45..d5f7d6b19 100644
--- a/playbooks/aws/openshift-cluster/service.yml
+++ b/playbooks/aws/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
@@ -16,7 +17,7 @@
groups: g_service_masters
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: "{{ g_master_hosts | default([]) }}"
+ with_items: "{{ master_hosts | default([]) }}"
- name: Evaluate g_service_nodes
add_host:
@@ -24,7 +25,7 @@
groups: g_service_nodes
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: "{{ g_node_hosts | default([]) }}"
+ with_items: "{{ 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 1fbd71a75..6090ed6fe 100644
--- a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
@@ -2,7 +2,8 @@
- set_fact:
created_by: "{{ lookup('env', 'LOGNAME')|default(cluster, true) }}"
docker_vol_ephemeral: "{{ lookup('env', 'os_docker_vol_ephemeral') | default(false, true) }}"
- env: "{{ cluster }}"
+ cluster: "{{ cluster_id }}"
+ env: "{{ cluster_env }}"
host_type: "{{ type }}"
sub_host_type: "{{ g_sub_host_type }}"
@@ -123,7 +124,8 @@
wait: yes
instance_tags:
created-by: "{{ created_by }}"
- env: "{{ env }}"
+ clusterid: "{{ cluster }}"
+ environment: "{{ cluster_env }}"
host-type: "{{ host_type }}"
sub-host-type: "{{ sub_host_type }}"
volumes: "{{ volumes }}"
@@ -139,7 +141,8 @@
Name: "{{ item.0 }}"
- set_fact:
- instance_groups: "tag_created-by_{{ created_by }}, tag_env_{{ env }}, tag_host-type_{{ host_type }}, tag_sub-host-type_{{ sub_host_type }}"
+ instance_groups: "tag_created-by_{{ created_by }}, tag_clusterid_{{ cluster }}, tag_environment_{{ cluster_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 aafd40c43..4b9c80b14 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/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 }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[scratch_group] | default([]) | difference(['localhost'])
+ with_items: (groups['tag_clusterid_' ~ cluster_id] | default([])) | difference(['localhost'])
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
@@ -29,34 +28,35 @@
connection: local
become: no
gather_facts: no
- vars:
- host_vars: "{{ hostvars
- | oo_select_keys(groups['oo_hosts_to_terminate']) }}"
tasks:
- name: Remove tags from instances
- ec2_tag: resource={{ item.ec2_id }} region={{ item.ec2_region }} state=absent
- args:
+ ec2_tag:
+ resource: "{{ hostvars[item]['ec2_id'] }}"
+ region: "{{ hostvars[item]['ec2_region'] }}"
+ state: absent
tags:
- env: "{{ item['ec2_tag_env'] }}"
- host-type: "{{ item['ec2_tag_host-type'] }}"
- sub_host_type: "{{ item['ec2_tag_sub-host-type'] }}"
- with_items: host_vars
+ environment: "{{ hostvars[item]['ec2_tag_environment'] }}"
+ clusterid: "{{ hostvars[item]['ec2_tag_clusterid'] }}"
+ host-type: "{{ hostvars[item]['ec2_tag_host-type'] }}"
+ sub_host_type: "{{ hostvars[item]['ec2_tag_sub-host-type'] }}"
+ with_items: groups.oo_hosts_to_terminate
when: "'oo_hosts_to_terminate' in groups"
- name: Terminate instances
ec2:
state: absent
- instance_ids: ["{{ item.ec2_id }}"]
- region: "{{ item.ec2_region }}"
+ instance_ids: ["{{ hostvars[item].ec2_id }}"]
+ region: "{{ hostvars[item].ec2_region }}"
ignore_errors: yes
register: ec2_term
- with_items: host_vars
+ with_items: groups.oo_hosts_to_terminate
when: "'oo_hosts_to_terminate' in groups"
# Fail if any of the instances failed to terminate with an error other
# than 403 Forbidden
- - fail: msg=Terminating instance {{ item.ec2_id }} failed with message {{ item.msg }}
- when: "'oo_hosts_to_terminate' in groups and item.failed and not item.msg | search(\"error: EC2ResponseError: 403 Forbidden\")"
+ - fail:
+ msg: "Terminating instance {{ item.ec2_id }} failed with message {{ item.msg }}"
+ when: "'oo_hosts_to_terminate' in groups and item.has_key('failed') and item.failed"
with_items: ec2_term.results
- name: Stop instance if termination failed
@@ -65,7 +65,7 @@
instance_ids: ["{{ item.item.ec2_id }}"]
region: "{{ item.item.ec2_region }}"
register: ec2_stop
- when: "'oo_hosts_to_terminate' in groups and item.failed"
+ when: "'oo_hosts_to_terminate' in groups and item.has_key('failed') and item.failed"
with_items: ec2_term.results
- name: Rename stopped instances
diff --git a/playbooks/aws/openshift-cluster/update.yml b/playbooks/aws/openshift-cluster/update.yml
index 3df0c3f3a..32bab76b5 100644
--- a/playbooks/aws/openshift-cluster/update.yml
+++ b/playbooks/aws/openshift-cluster/update.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: Update - 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 }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
+ with_items: "{{ g_all_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 20cc97c8a..231356798 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
@@ -2,32 +2,16 @@
# This playbook upgrades an existing AWS cluster, leaving nodes untouched if used with an 'online' deployment type.
# Usage:
# ansible-playbook playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml -e deployment_type=online -e cluster_id=<cluster_id>
-- hosts: localhost
- gather_facts: no
- vars_files:
- - ../../vars.yml
- - "../../vars.{{ deployment_type }}.{{ cluster_id }}.yml"
-
- tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
-
- - set_fact:
- tmp_nodes_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-node' }}"
- when: deployment_type != 'online'
-
- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+ vars_files:
+ - ../../../../aws/openshift-cluster/vars.yml
+ - ../../../../aws/openshift-cluster/cluster_hosts.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_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_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: "{{ ec2_private_ip_address }}"
openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/vars.yml b/playbooks/aws/openshift-cluster/vars.yml
index 95bc4b3e2..452c90d6a 100644
--- a/playbooks/aws/openshift-cluster/vars.yml
+++ b/playbooks/aws/openshift-cluster/vars.yml
@@ -1,4 +1,5 @@
---
+debug_level: 2
deployment_vars:
origin:
# centos-7, requires marketplace
diff --git a/playbooks/byo/openshift-cluster/cluster_hosts.yml b/playbooks/byo/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..e093b2580
--- /dev/null
+++ b/playbooks/byo/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,13 @@
+---
+g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+
+g_lb_hosts: "{{ groups.lb | default([]) }}"
+
+g_master_hosts: "{{ groups.masters | default([]) }}"
+
+g_node_hosts: "{{ groups.nodes | default([]) }}"
+
+g_nfs_hosts: "{{ groups.nfs | default([]) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/byo/openshift-cluster/config.yml b/playbooks/byo/openshift-cluster/config.yml
index eecf95994..5887b3208 100644
--- a/playbooks/byo/openshift-cluster/config.yml
+++ b/playbooks/byo/openshift-cluster/config.yml
@@ -1,11 +1,8 @@
---
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../byo/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_hosts: "{{ groups.etcd | default([]) }}"
- g_master_hosts: "{{ groups.masters | default([]) }}"
- g_nfs_hosts: "{{ groups.nfs | 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_debug_level: "{{ debug_level | default(2) }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/scaleup.yml b/playbooks/byo/openshift-cluster/scaleup.yml
index 8f8ef6f21..1702690f6 100644
--- a/playbooks/byo/openshift-cluster/scaleup.yml
+++ b/playbooks/byo/openshift-cluster/scaleup.yml
@@ -1,10 +1,8 @@
---
- include: ../../common/openshift-cluster/scaleup.yml
+ vars_files:
+ - ../../byo/openshift-cluster/cluster_hosts.yml
vars:
- 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_debug_level: "{{ debug_level | default(2) }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/upgrades/README.md b/playbooks/byo/openshift-cluster/upgrades/README.md
index ce7aebf8e..ca01dbc9d 100644
--- a/playbooks/byo/openshift-cluster/upgrades/README.md
+++ b/playbooks/byo/openshift-cluster/upgrades/README.md
@@ -1,6 +1,6 @@
# Upgrade playbooks
The playbooks provided in this directory can be used for upgrading an existing
-environment. Additional notes for the associated upgrade playbooks are
+cluster. Additional notes for the associated upgrade playbooks are
provided in their respective directories.
# Upgrades available
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 c3358eb4b..58c04d41d 100644
--- a/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+++ b/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
@@ -1,5 +1,7 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+ vars_files:
+ - ../../../../byo/openshift-cluster/cluster_hosts.yml
vars:
g_etcd_hosts: "{{ groups.etcd | default([]) }}"
g_master_hosts: "{{ groups.masters | default([]) }}"
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 960c00087..2f9e8dc7a 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,5 +1,7 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+ vars_files:
+ - ../../../../byo/openshift-cluster/cluster_hosts.yml
vars:
g_etcd_hosts: "{{ groups.etcd | default([]) }}"
g_master_hosts: "{{ groups.masters | default([]) }}"
diff --git a/playbooks/gce/openshift-cluster/cluster_hosts.yml b/playbooks/gce/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..2bfcedfc9
--- /dev/null
+++ b/playbooks/gce/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|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([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type-master']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|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_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([]) }}"
diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml
index 4a76e406a..3231ecc8e 100644
--- a/playbooks/gce/openshift-cluster/config.yml
+++ b/playbooks/gce/openshift-cluster/config.yml
@@ -1,33 +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
- tasks:
- - set_fact:
- 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: "{{ (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_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/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..dadceae58 100644
--- a/playbooks/gce/openshift-cluster/update.yml
+++ b/playbooks/gce/openshift-cluster/update.yml
@@ -1,16 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
- become: no
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:
@@ -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: "{{ 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:
diff --git a/playbooks/libvirt/openshift-cluster/cluster_hosts.yml b/playbooks/libvirt/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..198a3e4e2
--- /dev/null
+++ b/playbooks/libvirt/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|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([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type-master']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|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_nfs_hosts: "{{ (groups['tag_host-type-node']|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([]) }}"
diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index dcaec3924..be9cbbfaa 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -2,27 +2,14 @@
# TODO: need to figure out a plan for setting hostname, currently the default
# is localhost, so no hostname value (or public_hostname) value is getting
# assigned
-
-- hosts: localhost
- gather_facts: no
- become: no
- connection: local
- vars_files:
- - vars.yml
- tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
-
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../libvirt/openshift-cluster/vars.yml
+ - ../../libvirt/openshift-cluster/cluster_hosts.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-node']|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_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 }}"
diff --git a/playbooks/libvirt/openshift-cluster/list.yml b/playbooks/libvirt/openshift-cluster/list.yml
index d89e699f2..6cb81ee79 100644
--- a/playbooks/libvirt/openshift-cluster/list.yml
+++ b/playbooks/libvirt/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/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index ae8275ef6..ff1cedc94 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_sub-host-type-{{ g_sub_host_type }}'
+ groups: "tag_environment-{{ cluster_env }}, tag_host-type-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}, tag_clusterid-{{ cluster_id }}"
with_together:
- instances
- ips
diff --git a/playbooks/libvirt/openshift-cluster/templates/domain.xml b/playbooks/libvirt/openshift-cluster/templates/domain.xml
index c4ac6a434..0ca8e0974 100644
--- a/playbooks/libvirt/openshift-cluster/templates/domain.xml
+++ b/playbooks/libvirt/openshift-cluster/templates/domain.xml
@@ -3,7 +3,8 @@
<memory unit='GiB'>1</memory>
<metadata xmlns:ansible="https://github.com/ansible/ansible">
<ansible:tags>
- <ansible:tag>env-{{ cluster }}</ansible:tag>
+ <ansible:tag>environment-{{ cluster_env }}</ansible:tag>
+ <ansible:tag>clusterid-{{ cluster }}</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/terminate.yml b/playbooks/libvirt/openshift-cluster/terminate.yml
index a6b963608..8d845c8f2 100644
--- a/playbooks/libvirt/openshift-cluster/terminate.yml
+++ b/playbooks/libvirt/openshift-cluster/terminate.yml
@@ -9,7 +9,7 @@
vars_files:
- vars.yml
tasks:
- - set_fact: cluster_group=tag_env-{{ cluster_id }}
+ - set_fact: cluster_group=tag_clusterid-{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
diff --git a/playbooks/libvirt/openshift-cluster/update.yml b/playbooks/libvirt/openshift-cluster/update.yml
index 5e2bd3a3d..2dc540978 100644
--- a/playbooks/libvirt/openshift-cluster/update.yml
+++ b/playbooks/libvirt/openshift-cluster/update.yml
@@ -1,17 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
- become: no
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:
@@ -19,7 +14,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/libvirt/openshift-cluster/vars.yml b/playbooks/libvirt/openshift-cluster/vars.yml
index 67cfbcdb8..8b170f99e 100644
--- a/playbooks/libvirt/openshift-cluster/vars.yml
+++ b/playbooks/libvirt/openshift-cluster/vars.yml
@@ -3,6 +3,7 @@ libvirt_storage_pool_path: "{{ lookup('env','HOME') }}/libvirt-storage-pool-open
libvirt_storage_pool: 'openshift-ansible'
libvirt_network: openshift-ansible
libvirt_uri: 'qemu:///system'
+debug_level: 2
deployment_vars:
origin:
diff --git a/playbooks/openstack/openshift-cluster/cluster_hosts.yml b/playbooks/openstack/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..bc586d983
--- /dev/null
+++ b/playbooks/openstack/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type_etcd']|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([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type_master']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|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_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([]) }}"
diff --git a/playbooks/openstack/openshift-cluster/config.yml b/playbooks/openstack/openshift-cluster/config.yml
index 07a9d9488..b338d2eb4 100644
--- a/playbooks/openstack/openshift-cluster/config.yml
+++ b/playbooks/openstack/openshift-cluster/config.yml
@@ -1,24 +1,13 @@
-- hosts: localhost
- gather_facts: no
- become: no
- connection: local
- vars_files:
- - vars.yml
- tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
-
+---
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../openstack/openshift-cluster/vars.yml
+ - ../../openstack/openshift-cluster/cluster_hosts.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_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
- g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
+ g_nodeonmaster: true
+ g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
openshift_hostname: "{{ ansible_default_ipv4.address }}"
diff --git a/playbooks/openstack/openshift-cluster/launch.yml b/playbooks/openstack/openshift-cluster/launch.yml
index 876ca595a..f07ca684f 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_sub-host-type_default'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_etcd, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
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_sub-host-type_default'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_master, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
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_sub-host-type_compute'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_compute, tag_clusterid_{{ cluster_id }}'
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_sub-host-type_infra'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_infra, tag_clusterid_{{ cluster_id }}'
with_together:
- parsed_outputs.infra_names
- parsed_outputs.infra_ips
diff --git a/playbooks/openstack/openshift-cluster/list.yml b/playbooks/openstack/openshift-cluster/list.yml
index 436d3e6f7..123ebd323 100644
--- a/playbooks/openstack/openshift-cluster/list.yml
+++ b/playbooks/openstack/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/openstack/openshift-cluster/terminate.yml b/playbooks/openstack/openshift-cluster/terminate.yml
index 2a7f04505..d0abe9fa5 100644
--- a/playbooks/openstack/openshift-cluster/terminate.yml
+++ b/playbooks/openstack/openshift-cluster/terminate.yml
@@ -6,13 +6,12 @@
vars_files:
- vars.yml
tasks:
- - set_fact: cluster_group=tag_env_{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[cluster_group] | default([])
+ with_items: (groups['tag_environment_' ~ cluster_env]|default([])) | groups['tag_clusterid_' ~ cluster_id ] | default([])
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
diff --git a/playbooks/openstack/openshift-cluster/update.yml b/playbooks/openstack/openshift-cluster/update.yml
index 4ecf75a5d..2dc540978 100644
--- a/playbooks/openstack/openshift-cluster/update.yml
+++ b/playbooks/openstack/openshift-cluster/update.yml
@@ -1,17 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
- become: no
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:
@@ -19,7 +14,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/openstack/openshift-cluster/vars.yml b/playbooks/openstack/openshift-cluster/vars.yml
index e3796c91f..f8d15999e 100644
--- a/playbooks/openstack/openshift-cluster/vars.yml
+++ b/playbooks/openstack/openshift-cluster/vars.yml
@@ -1,4 +1,5 @@
---
+debug_level: 2
openstack_infra_heat_stack: "{{ lookup('oo_option', 'infra_heat_stack' ) |
default('files/heat_stack.yaml', True) }}"
openstack_network_cidr: "{{ lookup('oo_option', 'net_cidr' ) |