From 1f9ff3030c19d60cb6c639cde8b394994da892f0 Mon Sep 17 00:00:00 2001 From: ramamani yeleswarapu Date: Mon, 16 Apr 2018 17:00:59 -0700 Subject: Upgrade OpenStack version from Pike to Queens Change-Id: Ice7b3204ade23571df41fc4effb91bb5e125abac Signed-off-by: Ramamani Yeleswarapu --- .../inventories/HA-ansible-multinodes.tmpl | 74 +++++++++++++ .../openstack_queens/inventories/allinone.tmpl | 47 ++++++++ .../openstack_queens/inventories/multinodes.tmpl | 123 +++++++++++++++++++++ .../inventories/single-controller.tmpl | 67 +++++++++++ 4 files changed, 311 insertions(+) create mode 100755 deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/HA-ansible-multinodes.tmpl create mode 100755 deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/allinone.tmpl create mode 100755 deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/multinodes.tmpl create mode 100755 deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/single-controller.tmpl (limited to 'deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories') diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/HA-ansible-multinodes.tmpl new file mode 100755 index 00000000..7184d21d --- /dev/null +++ b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/HA-ansible-multinodes.tmpl @@ -0,0 +1,74 @@ +#set inventory_json = $getVar('inventory_json', []) +#!/usr/bin/env python + +import os +import sys +import copy +import argparse + +try: + import json +except ImportError: + import simplejson as json + +local_inventory='$inventory_json' + +def _byteify(data, ignore_dicts = False): + if isinstance(data, unicode): + return data.encode('utf-8') + if isinstance(data, list): + return [ _byteify(item, ignore_dicts=True) for item in data ] + if isinstance(data, dict) and not ignore_dicts: + return { + _byteify(key, ignore_dicts=True): _byteify(value, ignore_dicts=True) + for key, value in data.iteritems() + } + return data + +def merge_dict(ldict, rdict, overwrite=True): + if not (ldict and rdict): + return + + if not isinstance(ldict, dict): + raise TypeError('ldict type is %s not dict' % type(ldict)) + + if not isinstance(rdict, dict): + raise TypeError('rdict type is %s not dict' % type(rdict)) + + for key, value in rdict.items(): + if isinstance(value, dict) and key in ldict and isinstance(ldict[key], + dict): + merge_dict(ldict[key], value, overwrite) + else: + if overwrite or key not in ldict: + ldict[key] = copy.deepcopy(value) + +def load_inventory(inventory): + if not os.path.exists(inventory): + raise RuntimeError('file: %s not exist' % inventory) + with open(inventory, 'r') as fd: + return json.load(fd, object_hook=_byteify) + +def dump_inventory(inventory, data): + with open(inventory, 'w') as fd: + json.dump(data, fd, indent=4) + +def merge_inventory(linv, rinv): + ldata = load_inventory(linv) + rdata = load_inventory(rinv) + merge_dict(ldata, rdata, overwrite=True) + dump_inventory(linv, ldata) + +def read_cli_args(): + parser = argparse.ArgumentParser() + parser.add_argument('--list', action = 'store_true') + parser.add_argument('--merge', action = 'store') + return parser.parse_args() + +if __name__ == '__main__': + get_args = read_cli_args() + new_inventory = get_args.merge + if get_args.list: + print load_inventory(local_inventory) + elif new_inventory: + merge_inventory(local_inventory, new_inventory) diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/allinone.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/allinone.tmpl new file mode 100755 index 00000000..b320b9c5 --- /dev/null +++ b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/allinone.tmpl @@ -0,0 +1,47 @@ +#set controllers = $getVar('allinone_compute', []) +#set computes = $getVar('allinone_compute', []) +#set storages = $getVar('allinone_compute', []) +#set networks = $getVar('allinone_compute', []) +#if not $isinstance($controllers, list) + #set controllers = [$controllers] +#end if +#if not $isinstance($computes, list) + #set computes = [$computes] +#end if +#if not $isinstance($storages, list) + #set storages = [$storages] +#end if +#if not $isinstance($networks, list) + #set networks = [$networks] +#end if + +#set credentials = $getVar('server_credentials', {}) +#set username = $credentials.get('username', 'root') +#set password = $credentials.get('password', 'root') +[controller] +#for controller in $controllers + #set controller_ip = $controller.management.ip + #set controller_hostname = $controller.hostname +$controller_hostname ansible_ssh_host=$controller_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[compute] +#for compute in $computes + #set compute_ip = $compute.management.ip + #set compute_hostname = $compute.hostname +$compute_hostname ansible_ssh_host=$compute_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[network] +#for network in $networks + #set network_ip = $network.management.ip + #set network_hostname = $network.hostname +$network_hostname ansible_ssh_host=$network_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[storage] +#for storage in storages + #set storage_ip = $storage.management.ip + #set storage_hostname = $storage.hostname +$storage_hostname ansible_ssh_host=$storage_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/multinodes.tmpl new file mode 100755 index 00000000..b342d22f --- /dev/null +++ b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/multinodes.tmpl @@ -0,0 +1,123 @@ +#set compute_controllers = $getVar('compute_controller', []) +#set compute_workers = $getVar('compute_worker', []) +#set network_servers = $getVar('network_server', []) +#set network_workers = $getVar('network_worker', []) +#set databases = $getVar('database', []) +#set messagings = $getVar('messaging', []) +#set images = $getVar('image', []) +#set dashboards = $getVar('dashboard', []) +#set identities = $getVar('identity', []) +#set storage_controllers = $getVar('storage_controller', []) +#set storage_volumes = $getVar('storage_volume', []) +#if not $isinstance($compute_controllers, list) + #set compute_controllers = [$compute_controllers] +#end if +#if not $isinstance($compute_workers, list) + #set compute_workers = [$compute_workers] +#end if +#if not $isinstance($network_servers, list) + #set network_servers = [$network_servers] +#end if +#if not $isinstance($network_workers, list) + #set network_workers = [$network_workers] +#end if +#if not $isinstance($databases, list) + #set databases = [$databases] +#end if +#if not $isinstance($messagings, list) + #set messagings = [$messagings] +#end if +#if not $isinstance($images, list) + #set images = [$images] +#end if +#if not $isinstance($dashboards, list) + #set dashboards = [$dashboards] +#end if +#if not $isinstance($identities, list) + #set identities = [$identities] +#end if +#if not $isinstance($storage_controllers, list) + #set storage_controllers = [$storage_controllers] +#end if +#if not $isinstance($storage_volumes, list) + #set storage_volumes = [$storage_volumes] +#end if +#set credentials = $getVar('server_credentials', {}) +#set username = $credentials.get('username', 'root') +#set password = $credentials.get('password', 'root') +[compute-controller] +#for controller in $compute_controllers + #set controller_ip = $controller.management.ip + #set controller_hostname = $controller.hostname +$controller_hostname ansible_ssh_host=$controller_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[compute-worker] +#for compute in $compute_workers + #set compute_ip = $compute.management.ip + #set compute_hostname = $compute.hostname +$compute_hostname ansible_ssh_host=$compute_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[network-server] +#for network in $network_servers + #set network_ip = $network.management.ip + #set network_hostname = $network.hostname +$network_hostname ansible_ssh_host=$network_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[network-worker] +#for network in $network_workers + #set network_ip = $network.management.ip + #set network_hostname = $network.hostname +$network_hostname ansible_ssh_host=$network_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[database] +#for worker in $databases + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[messaging] +#for worker in $messagings + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[image] +#for worker in $images + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[dashboard] +#for worker in $dashboards + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[identity] +#for worker in $identities + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[storage-controller] +#for worker in $storage_controllers + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[storage-volume] +#for worker in $storage_volumes + #set worker_ip = $worker.management.ip + #set worker_hostname = $worker.hostname +$worker_hostname ansible_ssh_host=$worker_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/single-controller.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/single-controller.tmpl new file mode 100755 index 00000000..1afb45fa --- /dev/null +++ b/deploy/compass_conf/templates/ansible_installer/openstack_queens/inventories/single-controller.tmpl @@ -0,0 +1,67 @@ +#set controllers = $getVar('controller', []) +#set computes = $getVar('compute', []) +#set storages = $getVar('storage', []) +#set networks = $getVar('network', []) +#set odls = $getVar('odl', []) +#set onoss = $getVar('onos', []) +#if not $isinstance($controllers, list) + #set controllers = [$controllers] +#end if +#if not $isinstance($computes, list) + #set computes = [$computes] +#end if +#if not $isinstance($storages, list) + #set storages = [$storages] +#end if +#if not $isinstance($networks, list) + #set networks = [$networks] +#end if +#if not $isinstance($odls, list) + #set odls = [$odls] +#end if +#if not $isinstance($onoss, list) + #set onoss = [$onoss] +#end if + +#set credentials = $getVar('server_credentials', {}) +#set username = $credentials.get('username', 'root') +#set password = $credentials.get('password', 'root') +[controller] +#for controller in $controllers + #set controller_ip = $controller.management.ip + #set controller_hostname = $controller.hostname +$controller_hostname ansible_ssh_host=$controller_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[compute] +#for compute in $computes + #set compute_ip = $compute.management.ip + #set compute_hostname = $compute.hostname +$compute_hostname ansible_ssh_host=$compute_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[network] +#for network in $networks + #set network_ip = $network.management.ip + #set network_hostname = $network.hostname +$network_hostname ansible_ssh_host=$network_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for + +[storage] +#for storage in storages + #set storage_ip = $storage.management.ip + #set storage_hostname = $storage.hostname +$storage_hostname ansible_ssh_host=$storage_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for +[odl] +#for odl in odls + #set odl_ip = $odl.management.ip + #set odl_hostname = $odl.hostname +$odl_hostname ansible_ssh_host=$odl_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for +[storage] +#for storage in storages + #set storage_ip = $storage.management.ip + #set storage_hostname = $storage.hostname +$storage_hostname ansible_ssh_host=$storage_ip ansible_ssh_user=$username ansible_ssh_pass=$password +#end for -- cgit 1.2.3-korg