def uninstall_openstack_node(*args): """Uninstalls openstack pkgs in one or list of nodes. USAGE:fab uninstall_openstack_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): pkg = ['contrail-openstack'] if len(env.roledefs['openstack']) > 1 and get_openstack_internal_vip(): pkg.append('contrail-openstack-ha') if is_ceilometer_install_supported(): pkg += get_openstack_ceilometer_pkgs() pkg += get_ceilometer_plugin_pkgs() if detect_ostype() == 'ubuntu': with settings(warn_only=True): sudo("umount /var/lib/glance/images") sudo("sed -i '/.*glance.*/d' /etc/fstab") apt_uninstall(pkg) else: pkgs = get_pkg_list() yum_uninstall(pkgs) with cd('/etc/'): sudo('sudo rm -rf glance/ cinder/ openstack_dashboard/ keystone/ quantum/ nova/ haproxy/ keepalived/') with cd('/var/lib/'): sudo('sudo rm -rf nova quantum glance quantum keystone mysql haproxy') with cd('/var/run'): sudo('sudo rm -rf cinder glance quantum nova keystone') with cd('/var/log'): sudo('sudo rm -rf contrail/* nova quantum glance cinder ~/keystone-signing /tmp/keystone-signing /tmp/keystone-signing-nova')
def install_ceilometer_node(*args): """Installs openstack pkgs in one or list of nodes. USAGE:fab install_ceilometer_node:[email protected],[email protected]""" for host_string in args: if env.roledefs['openstack'] and \ host_string != env.roledefs['openstack'][0]: continue with settings(host_string=host_string): if not is_ceilometer_install_supported(): continue pkg_ceilometer = get_openstack_ceilometer_pkgs() act_os_type = detect_ostype() openstack_sku = get_openstack_sku() if not pkg_ceilometer: raise RuntimeError('Unsupported OpenStack distribution (%s) ' 'on (%s)' % (openstack_sku, act_os_type)) if act_os_type == 'ubuntu': apt_install(pkg_ceilometer) elif act_os_type in ['redhat']: # We need to copy the pkg from the cfgm node # and then install it on the openstack node cfgm_node = env.roledefs['cfgm'][0] local_tempdir = tempfile.mkdtemp() with lcd(local_tempdir): for pkg in pkg_ceilometer: with settings(host_string = cfgm_node): get('/opt/contrail/contrail_install_repo/%s*.rpm' % (pkg), local_tempdir) output = local("ls %s/*.rpm" % (local_tempdir), capture=True) pkg_list = output.split('\n') for pkg in pkg_list: install_pkg_node(pkg, host_string) local('rm -rf %s' % (local_tempdir)) else: yum_install(pkg_ceilometer)
def install_ceilometer_node(*args): """Installs openstack pkgs in one or list of nodes. USAGE:fab install_ceilometer_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): if not is_ceilometer_install_supported(): continue pkg_ceilometer = get_openstack_ceilometer_pkgs() act_os_type = detect_ostype() openstack_sku = get_openstack_sku() if not pkg_ceilometer: raise RuntimeError('Unsupported OpenStack distribution (%s) ' 'on (%s)' % (openstack_sku, act_os_type)) if act_os_type == 'ubuntu': apt_install(pkg_ceilometer) elif act_os_type in ['redhat']: # We need to copy the pkg from the cfgm node # and then install it on the openstack node cfgm_node = env.roledefs['cfgm'][0] local_tempdir = tempfile.mkdtemp() with lcd(local_tempdir): for pkg in pkg_ceilometer: with settings(host_string = cfgm_node): get('/opt/contrail/contrail_install_repo/%s*.rpm' % (pkg), local_tempdir) output = local("ls %s/*.rpm" % (local_tempdir), capture=True) pkg_list = output.split('\n') for pkg in pkg_list: install_pkg_node(pkg, host_string) local('rm -rf %s' % (local_tempdir)) else: yum_install(pkg_ceilometer)
def uninstall_openstack_node(*args): """Uninstalls openstack pkgs in one or list of nodes. USAGE:fab uninstall_openstack_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): pkg = ['contrail-openstack'] if len(env.roledefs['openstack'] ) > 1 and get_openstack_internal_vip(): pkg.append('contrail-openstack-ha') if is_ceilometer_install_supported(): pkg += get_openstack_ceilometer_pkgs() pkg += get_ceilometer_plugin_pkgs() if detect_ostype() == 'ubuntu': with settings(warn_only=True): sudo("umount /var/lib/glance/images") sudo("sed -i '/.*glance.*/d' /etc/fstab") apt_uninstall(pkg) else: pkgs = get_pkg_list() yum_uninstall(pkgs) with cd('/etc/'): sudo( 'sudo rm -rf glance/ cinder/ openstack_dashboard/ keystone/ quantum/ nova/ haproxy/ keepalived/' ) with cd('/var/lib/'): sudo( 'sudo rm -rf nova quantum glance quantum keystone mysql haproxy' ) with cd('/var/run'): sudo('sudo rm -rf cinder glance quantum nova keystone') with cd('/var/log'): sudo( 'sudo rm -rf contrail/* nova quantum glance cinder ~/keystone-signing /tmp/keystone-signing /tmp/keystone-signing-nova' )
def install_database_node(install_mongodb, *args): """Installs database pkgs in one or list of nodes. USAGE:fab install_database_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): pkg = ['contrail-openstack-database'] if install_mongodb and is_ceilometer_install_supported(use_install_repo=True): pkgs_ceilometer_database = ['mongodb-clients', 'mongodb-server'] pkg.extend(pkgs_ceilometer_database) if detect_ostype() == 'ubuntu': sudo('echo "manual" >> /etc/init/supervisor-database.override') apt_install(pkg) else: yum_install(pkg)
def install_database_node(install_mongodb, *args): """Installs database pkgs in one or list of nodes. USAGE:fab install_database_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): pkg = ['contrail-openstack-database'] (dist, version, extra) = get_linux_distro() if dist.lower() == 'ubuntu' and version == '14.04': pkg = ['default-jre-headless'] + pkg if install_mongodb and is_ceilometer_install_supported(use_install_repo=True): pkgs_ceilometer_database = ['mongodb-clients', 'mongodb-server'] pkg.extend(pkgs_ceilometer_database) if detect_ostype() == 'ubuntu': sudo('echo "manual" >> /etc/init/supervisor-database.override') apt_install(pkg) else: yum_install(pkg)
def install_database_node(install_mongodb, *args): """Installs database pkgs in one or list of nodes. USAGE:fab install_database_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): pkg = ["contrail-openstack-database"] (dist, version, extra) = get_linux_distro() if dist.lower() == "ubuntu" and version == "14.04": pkg = ["default-jre-headless"] + pkg if install_mongodb and is_ceilometer_install_supported(use_install_repo=True): pkgs_ceilometer_database = ["mongodb-clients", "mongodb-server"] pkg.extend(pkgs_ceilometer_database) if detect_ostype() == "ubuntu": sudo('echo "manual" >> /etc/init/supervisor-database.override') apt_install(pkg) else: yum_install(pkg)
def install_ceilometer_node(*args): """Installs openstack pkgs in one or list of nodes. USAGE:fab install_ceilometer_node:[email protected],[email protected]""" for host_string in args: if env.roledefs['openstack'] and \ host_string != env.roledefs['openstack'][0]: continue with settings(host_string=host_string): if not is_ceilometer_install_supported(): continue pkg_havana_ubuntu = [ 'mongodb', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'python-ceilometerclient' ] pkg_icehouse_ubuntu = [ 'mongodb', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'ceilometer-agent-notification', 'ceilometer-alarm-evaluator', 'ceilometer-alarm-notifier', 'python-ceilometerclient', 'ceilometer-plugin-contrail' ] pkg_juno_ubuntu = [ 'mongodb-server', 'mongodb-clients', 'python-pymongo', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'ceilometer-agent-notification', 'ceilometer-alarm-evaluator', 'ceilometer-alarm-notifier', 'python-ceilometerclient', 'ceilometer-plugin-contrail' ] pkg_icehouse_redhat = ['ceilometer-plugin-contrail'] act_os_type = detect_ostype() openstack_sku = get_openstack_sku() if openstack_sku == 'havana': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_havana_ubuntu else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) elif openstack_sku == 'icehouse': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_icehouse_ubuntu elif act_os_type in ['redhat']: pkg_ceilometer = pkg_icehouse_redhat else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) elif openstack_sku == 'juno': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_juno_ubuntu else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) else: raise RuntimeError('Unsupported OpenStack distribution (%s) ' 'on (%s)' % (openstack_sku, act_os_type)) if act_os_type == 'ubuntu': apt_install(pkg_ceilometer) elif act_os_type in ['redhat']: # We need to copy the pkg from the cfgm node # and then install it on the openstack node cfgm_node = env.roledefs['cfgm'][0] local_tempdir = tempfile.mkdtemp() with lcd(local_tempdir): for pkg in pkg_ceilometer: with settings(host_string=cfgm_node): get( '/opt/contrail/contrail_install_repo/%s*.rpm' % (pkg), local_tempdir) output = local("ls %s/*.rpm" % (local_tempdir), capture=True) pkg_list = output.split('\n') for pkg in pkg_list: install_pkg_node(pkg, host_string) local('rm -rf %s' % (local_tempdir)) else: yum_install(pkg_ceilometer)
def install_ceilometer_node(*args): """Installs openstack pkgs in one or list of nodes. USAGE:fab install_ceilometer_node:[email protected],[email protected]""" for host_string in args: if env.roledefs['openstack'] and \ host_string != env.roledefs['openstack'][0]: continue with settings(host_string=host_string): if not is_ceilometer_install_supported(): continue pkg_havana_ubuntu = ['mongodb', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'python-ceilometerclient'] pkg_icehouse_ubuntu = ['mongodb', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'ceilometer-agent-notification', 'ceilometer-alarm-evaluator', 'ceilometer-alarm-notifier', 'python-ceilometerclient', 'ceilometer-plugin-contrail'] pkg_juno_ubuntu = ['mongodb-server', 'mongodb-clients', 'python-pymongo', 'ceilometer-api', 'ceilometer-collector', 'ceilometer-agent-central', 'ceilometer-agent-notification', 'ceilometer-alarm-evaluator', 'ceilometer-alarm-notifier', 'python-ceilometerclient', 'ceilometer-plugin-contrail'] pkg_icehouse_redhat = ['ceilometer-plugin-contrail'] act_os_type = detect_ostype() openstack_sku = get_openstack_sku() if openstack_sku == 'havana': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_havana_ubuntu else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) elif openstack_sku == 'icehouse': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_icehouse_ubuntu elif act_os_type in ['redhat']: pkg_ceilometer = pkg_icehouse_redhat else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) elif openstack_sku == 'juno': if act_os_type == 'ubuntu': pkg_ceilometer = pkg_juno_ubuntu else: raise RuntimeError('Unsupported OpenStack distribution ' '(%s) on OS type (%s)' % (openstack_sku, act_os_type)) else: raise RuntimeError('Unsupported OpenStack distribution (%s) ' 'on (%s)' % (openstack_sku, act_os_type)) if act_os_type == 'ubuntu': apt_install(pkg_ceilometer) elif act_os_type in ['redhat']: # We need to copy the pkg from the cfgm node # and then install it on the openstack node cfgm_node = env.roledefs['cfgm'][0] local_tempdir = tempfile.mkdtemp() with lcd(local_tempdir): for pkg in pkg_ceilometer: with settings(host_string = cfgm_node): get('/opt/contrail/contrail_install_repo/%s*.rpm' % (pkg), local_tempdir) output = local("ls %s/*.rpm" % (local_tempdir), capture=True) pkg_list = output.split('\n') for pkg in pkg_list: install_pkg_node(pkg, host_string) local('rm -rf %s' % (local_tempdir)) else: yum_install(pkg_ceilometer)