From 80f144b8667c256594abc33f48f066331051aea1 Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Wed, 10 Jan 2018 07:20:54 -0800 Subject: Enable ODL This patch enable the alternative to provision OpenDaylight as a SDN Controller for OpenStack using Kolla as an installer. Change-Id: I4837cc7600cad07600dd5202aa9695ca8b2a8c70 Signed-off-by: Victor Morales Issue-ID: INT-329 --- bootstrap/vagrant-onap/lib/files/all-in-one | 585 ++++++++++++++++++++++ bootstrap/vagrant-onap/lib/files/globals.yml | 2 + bootstrap/vagrant-onap/lib/files/kolla-build.conf | 5 + bootstrap/vagrant-onap/lib/files/passwords.yml | 216 ++++++++ bootstrap/vagrant-onap/lib/functions | 6 +- bootstrap/vagrant-onap/lib/openstack | 84 ++-- 6 files changed, 862 insertions(+), 36 deletions(-) create mode 100644 bootstrap/vagrant-onap/lib/files/all-in-one create mode 100644 bootstrap/vagrant-onap/lib/files/globals.yml create mode 100644 bootstrap/vagrant-onap/lib/files/kolla-build.conf create mode 100644 bootstrap/vagrant-onap/lib/files/passwords.yml (limited to 'bootstrap/vagrant-onap') diff --git a/bootstrap/vagrant-onap/lib/files/all-in-one b/bootstrap/vagrant-onap/lib/files/all-in-one new file mode 100644 index 000000000..efdb2bfce --- /dev/null +++ b/bootstrap/vagrant-onap/lib/files/all-in-one @@ -0,0 +1,585 @@ +# These initial groups are the only groups required to be modified. The +# additional groups are for more control of the environment. +[control] +localhost ansible_connection=local + +[network] +localhost ansible_connection=local + +[compute] +localhost ansible_connection=local + +[storage] +localhost ansible_connection=local + +[monitoring] +localhost ansible_connection=local + +[deployment] +localhost ansible_connection=local + +# You can explicitly specify which hosts run each project by updating the +# groups in the sections below. Common services are grouped together. +[chrony-server:children] +haproxy + +[chrony:children] +network +compute +storage +monitoring + +[collectd:children] +compute + +[baremetal:children] +control + +[grafana:children] +monitoring + +[etcd:children] +control +compute + +[karbor:children] +control + +[kibana:children] +control + +[telegraf:children] +compute +control +monitoring +network +storage + +[elasticsearch:children] +control + +[haproxy:children] +network + +[hyperv] +#hyperv_host + +[hyperv:vars] +#ansible_user=user +#ansible_password=password +#ansible_port=5986 +#ansible_connection=winrm +#ansible_winrm_server_cert_validation=ignore + +[mariadb:children] +control + +[rabbitmq:children] +control + +[outward-rabbitmq:children] +control + +[qdrouterd:children] +control + +[mongodb:children] +control + +[keystone:children] +control + +[glance:children] +control + +[nova:children] +control + +[neutron:children] +network + +[openvswitch:children] +network +compute +manila-share + +[opendaylight:children] +network + +[cinder:children] +control + +[cloudkitty:children] +control + +[freezer:children] +control + +[memcached:children] +control + +[horizon:children] +control + +[swift:children] +control + +[barbican:children] +control + +[heat:children] +control + +[murano:children] +control + +[ceph:children] +control + +[ironic:children] +control + +[influxdb:children] +monitoring + +[magnum:children] +control + +[sahara:children] +control + +[solum:children] +control + +[mistral:children] +control + +[manila:children] +control + +[panko:children] +control + +[gnocchi:children] +control + +[ceilometer:children] +control + +[aodh:children] +control + +[congress:children] +control + +[tacker:children] +control + +# Tempest +[tempest:children] +control + +[senlin:children] +control + +[vmtp:children] +control + +[trove:children] +control + +[watcher:children] +control + +[rally:children] +control + +[searchlight:children] +control + +[octavia:children] +control + +[designate:children] +control + +[placement:children] +control + +[bifrost:children] +deployment + +[zun:children] +control + +[skydive:children] +monitoring + +[redis:children] +control + +# Additional control implemented here. These groups allow you to control which +# services run on which hosts at a per-service level. +# +# Word of caution: Some services are required to run on the same host to +# function appropriately. For example, neutron-metadata-agent must run on the +# same host as the l3-agent and (depending on configuration) the dhcp-agent. + +# Glance +[glance-api:children] +glance + +[glance-registry:children] +glance + +# Nova +[nova-api:children] +nova + +[nova-conductor:children] +nova + +[nova-consoleauth:children] +nova + +[nova-novncproxy:children] +nova + +[nova-scheduler:children] +nova + +[nova-spicehtml5proxy:children] +nova + +[nova-compute-ironic:children] +nova + +[nova-serialproxy:children] +nova + +# Neutron +[neutron-server:children] +control + +[neutron-dhcp-agent:children] +neutron + +[neutron-l3-agent:children] +neutron + +[neutron-lbaas-agent:children] +neutron + +[neutron-metadata-agent:children] +neutron + +[neutron-vpnaas-agent:children] +neutron + +[neutron-bgp-dragent:children] +neutron + +# Ceph +[ceph-mon:children] +ceph + +[ceph-rgw:children] +ceph + +[ceph-osd:children] +storage + +# Cinder +[cinder-api:children] +cinder + +[cinder-backup:children] +storage + +[cinder-scheduler:children] +cinder + +[cinder-volume:children] +storage + +# Cloudkitty +[cloudkitty-api:children] +cloudkitty + +[cloudkitty-processor:children] +cloudkitty + +# Freezer +[freezer-api:children] +freezer + +# iSCSI +[iscsid:children] +compute +storage +ironic-conductor + +[tgtd:children] +storage + +# Karbor +[karbor-api:children] +karbor + +[karbor-protection:children] +karbor + +[karbor-operationengine:children] +karbor + +# Manila +[manila-api:children] +manila + +[manila-scheduler:children] +manila + +[manila-share:children] +network + +[manila-data:children] +manila + +# Swift +[swift-proxy-server:children] +swift + +[swift-account-server:children] +storage + +[swift-container-server:children] +storage + +[swift-object-server:children] +storage + +# Barbican +[barbican-api:children] +barbican + +[barbican-keystone-listener:children] +barbican + +[barbican-worker:children] +barbican + +# Trove +[trove-api:children] +trove + +[trove-conductor:children] +trove + +[trove-taskmanager:children] +trove + +# Heat +[heat-api:children] +heat + +[heat-api-cfn:children] +heat + +[heat-engine:children] +heat + +# Murano +[murano-api:children] +murano + +[murano-engine:children] +murano + +# Ironic +[ironic-api:children] +ironic + +[ironic-conductor:children] +ironic + +[ironic-inspector:children] +ironic + +[ironic-pxe:children] +ironic + +# Magnum +[magnum-api:children] +magnum + +[magnum-conductor:children] +magnum + +# Solum +[solum-api:children] +solum + +[solum-worker:children] +solum + +[solum-deployer:children] +solum + +[solum-conductor:children] +solum + +# Mistral +[mistral-api:children] +mistral + +[mistral-executor:children] +mistral + +[mistral-engine:children] +mistral + +# Aodh +[aodh-api:children] +aodh + +[aodh-evaluator:children] +aodh + +[aodh-listener:children] +aodh + +[aodh-notifier:children] +aodh + +# Panko +[panko-api:children] +panko + +# Gnocchi +[gnocchi-api:children] +gnocchi + +[gnocchi-statsd:children] +gnocchi + +[gnocchi-metricd:children] +gnocchi + +# Sahara +[sahara-api:children] +sahara + +[sahara-engine:children] +sahara + +# Ceilometer +[ceilometer-api:children] +ceilometer + +[ceilometer-central:children] +ceilometer + +[ceilometer-notification:children] +ceilometer + +[ceilometer-collector:children] +ceilometer + +[ceilometer-compute:children] +compute + +# Congress +[congress-api:children] +congress + +[congress-datasource:children] +congress + +[congress-policy-engine:children] +congress + +# Multipathd +[multipathd:children] +compute + +# Watcher +[watcher-api:children] +watcher + +[watcher-engine:children] +watcher + +[watcher-applier:children] +watcher + +# Senlin +[senlin-api:children] +senlin + +[senlin-engine:children] +senlin + +# Searchlight +[searchlight-api:children] +searchlight + +[searchlight-listener:children] +searchlight + +# Octavia +[octavia-api:children] +octavia + +[octavia-health-manager:children] +octavia + +[octavia-housekeeping:children] +octavia + +[octavia-worker:children] +octavia + +# Designate +[designate-api:children] +designate + +[designate-central:children] +designate + +[designate-mdns:children] +network + +[designate-worker:children] +designate + +[designate-sink:children] +designate + +[designate-backend-bind9:children] +designate + +# Placement +[placement-api:children] +placement + +# Zun +[zun-api:children] +zun + +[zun-compute:children] +compute + +# Skydive +[skydive-analyzer:children] +skydive + +[skydive-agent:children] +compute +network + +# Tacker +[tacker-server:children] +tacker + +[tacker-conductor:children] +tacker diff --git a/bootstrap/vagrant-onap/lib/files/globals.yml b/bootstrap/vagrant-onap/lib/files/globals.yml new file mode 100644 index 000000000..d10cc3d83 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/files/globals.yml @@ -0,0 +1,2 @@ +--- +openstack_release: "master" diff --git a/bootstrap/vagrant-onap/lib/files/kolla-build.conf b/bootstrap/vagrant-onap/lib/files/kolla-build.conf new file mode 100644 index 000000000..8dd14e6c6 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/files/kolla-build.conf @@ -0,0 +1,5 @@ +[DEFAULT] +base = ubuntu +profile = main + +[profiles] diff --git a/bootstrap/vagrant-onap/lib/files/passwords.yml b/bootstrap/vagrant-onap/lib/files/passwords.yml new file mode 100644 index 000000000..f376e31f0 --- /dev/null +++ b/bootstrap/vagrant-onap/lib/files/passwords.yml @@ -0,0 +1,216 @@ +--- +################### +# Ceph options +#################### +# These options must be UUID4 values in string format +# XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX +ceph_cluster_fsid: +ceph_rgw_keystone_password: +# for backward compatible consideration, rbd_secret_uuid is only used for nova, +# cinder_rbd_secret_uuid is used for cinder +rbd_secret_uuid: +cinder_rbd_secret_uuid: + +################### +# Database options +#################### +database_password: + +#################### +# Docker options +#################### +# This should only be set if you require a password for your Docker registry +docker_registry_password: + +###################### +# OpenDaylight options +###################### +opendaylight_password: + +#################### +# OpenStack options +#################### +aodh_database_password: +aodh_keystone_password: + +barbican_database_password: +barbican_keystone_password: +barbican_p11_password: +barbican_crypto_key: + +keystone_admin_password: +keystone_database_password: + +grafana_database_password: +grafana_admin_password: + +glance_database_password: +glance_keystone_password: + +gnocchi_database_password: +gnocchi_keystone_password: + +karbor_database_password: +karbor_keystone_password: +karbor_openstack_infra_id: + +kuryr_keystone_password: + +nova_database_password: +nova_api_database_password: +nova_keystone_password: + +placement_keystone_password: + +neutron_database_password: +neutron_keystone_password: +metadata_secret: + +cinder_database_password: +cinder_keystone_password: + +cloudkitty_database_password: +cloudkitty_keystone_password: + +panko_database_password: +panko_keystone_password: + +freezer_database_password: +freezer_keystone_password: + +sahara_database_password: +sahara_keystone_password: + +designate_database_password: +designate_pool_manager_database_password: +designate_keystone_password: +# This option must be UUID4 value in string format +designate_pool_id: +# This option must be HMAC-MD5 value in string format +designate_rndc_key: + +swift_keystone_password: +swift_hash_path_suffix: +swift_hash_path_prefix: + +heat_database_password: +heat_keystone_password: +heat_domain_admin_password: + +murano_database_password: +murano_keystone_password: +murano_agent_rabbitmq_password: + +ironic_database_password: +ironic_keystone_password: + +ironic_inspector_database_password: +ironic_inspector_keystone_password: + +magnum_database_password: +magnum_keystone_password: + +mistral_database_password: +mistral_keystone_password: + +trove_database_password: +trove_keystone_password: + +ceilometer_database_password: +ceilometer_keystone_password: + +watcher_database_password: +watcher_keystone_password: + +congress_database_password: +congress_keystone_password: + +rally_database_password: + +senlin_database_password: +senlin_keystone_password: + +solum_database_password: +solum_keystone_password: + +horizon_secret_key: +horizon_database_password: + +telemetry_secret_key: + +manila_database_password: +manila_keystone_password: + +octavia_database_password: +octavia_keystone_password: +octavia_ca_password: + +searchlight_keystone_password: + +tacker_database_password: +tacker_keystone_password: + +zun_database_password: +zun_keystone_password: + +memcache_secret_key: + +#HMAC secret key +osprofiler_secret: + +nova_ssh_key: + private_key: + public_key: + +kolla_ssh_key: + private_key: + public_key: + +keystone_ssh_key: + private_key: + public_key: + +bifrost_ssh_key: + private_key: + public_key: + +#################### +# Gnocchi options +#################### +gnocchi_project_id: +gnocchi_resource_id: +gnocchi_user_id: + +#################### +# Qdrouterd options +#################### +qdrouterd_password: + +#################### +# RabbitMQ options +#################### +rabbitmq_password: +rabbitmq_cluster_cookie: +outward_rabbitmq_password: +outward_rabbitmq_cluster_cookie: + +#################### +# HAProxy options +#################### +haproxy_password: +keepalived_password: + +#################### +# Kibana options +#################### +kibana_password: + +#################### +# etcd options +#################### +etcd_cluster_token: + +#################### +# redis options +#################### +redis_master_password: diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 9531fc794..c2c6d76a5 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -141,7 +141,7 @@ function _configure_docker_settings { local chameleonsocks_filename=chameleonsocks.sh local max_concurrent_downloads=${1:-3} - cp $docker_conf $docker_conf_backup + cp ${docker_conf} ${docker_conf_backup} if [ $http_proxy ]; then echo "export http_proxy=$http_proxy" >> $docker_conf fi @@ -156,10 +156,10 @@ function _configure_docker_settings { port=$(echo $socks_proxy | sed -e "s/^.*://") PROXY=$socks PORT=$port ./$chameleonsocks_filename --install rm $chameleonsocks_filename - cp $docker_conf_backup $docker_conf + cp ${docker_conf_backup} ${docker_conf} fi fi - rm $docker_conf_backup + rm ${docker_conf_backup} echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --max-concurrent-downloads $max_concurrent_downloads \"" >> $docker_conf usermod -aG docker $USER diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack index 6fe20d94c..205d7ae80 100755 --- a/bootstrap/vagrant-onap/lib/openstack +++ b/bootstrap/vagrant-onap/lib/openstack @@ -2,52 +2,70 @@ source /var/onap/functions -# deploy_openstack() - Function that provisions an OpenStack deployment -function deploy_openstack { - local network_id=${1:-"192.168.53.0"} - nic=$(ip route get $network_id | awk '{ print $4; exit }') - ip_address=$(ip route get $network_id | awk '{ print $6; exit }') - internal_vip_address=$(get_next_ip $ip_address) +kolla_config=/etc/kolla +kolla_build=$kolla_config/kolla-build.conf +kolla_passwords=$kolla_config/passwords.yml +kolla_globals=$kolla_config/globals.yml +kolla_inventory=/var/onap/files/all-in-one +# install_dependencies() - Function that installs Kolla-Ansible requirements +function install_dependencies { install_docker + mkdir -p /etc/systemd/system/docker.service.d tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF' [Service] MountFlags=shared EOF - install_packages python-dev libffi-dev gcc libssl-dev python-selinux gcc + systemctl daemon-reload + systemctl restart docker install_python_package ansible docker kolla-ansible python-openstackclient - source /etc/os-release || source /usr/lib/os-release - case ${ID,,} in - *suse) - ;; - ubuntu|debian) - service docker restart - - cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/kolla/ - cp /usr/local/share/kolla-ansible/ansible/inventory/* . - sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"ubuntu\"/g" /etc/kolla/globals.yml - ;; - rhel|centos|fedora) - systemctl daemon-reload - systemctl restart docker - - cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/ - cp /usr/share/kolla-ansible/ansible/inventory/* . - sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"centos\"/g" /etc/kolla/globals.yml - ;; - esac +} + +# configure_deploy() - Function that modifies configuration files +function configure_deploy { + local network_id=$1 + local enable_opendaylight=${2-False} + local openstack_services="main = ceilometer,cinder,glance,heat,horizon,isci,keystone,neutron,nova-,swift" + nic=$(ip route get $network_id | awk '{ print $4; exit }') + ip_address=$(ip route get $network_id | awk '{ print $6; exit }') + internal_vip_address=$(get_next_ip $ip_address) + + mkdir -p $kolla_config + cp /var/onap/files/globals.yml $kolla_globals + cp /var/onap/files/passwords.yml $kolla_passwords + cp /var/onap/files/kolla-build.conf $kolla_build kolla-genpwd - sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml + echo "network_interface: \"$nic\"" >> $kolla_globals + echo "kolla_internal_vip_address: \"$internal_vip_address\"" >> $kolla_globals + echo "api_interface: \"{{ network_interface }}\"" >> $kolla_globals + if [[ $enable_opendaylight == True ]]; then + echo "enable_opendaylight: \"yes\"" >> $kolla_globals + openstack_services+=",opendaylight" + fi + echo $openstack_services >> $kolla_build - sed -i "s/#network_interface: \"eth0\"/network_interface: \"$nic\"/g" /etc/kolla/globals.yml - sed -i "s/kolla_internal_vip_address: \"10.10.10.254\"/kolla_internal_vip_address: \"$internal_vip_address\"/g" /etc/kolla/globals.yml - sed -i "s/#api_interface: \"{{ network_interface }}\"/api_interface: \"{{ network_interface }}\"/g" /etc/kolla/globals.yml echo "$ip_address $(hostname)" >> /etc/hosts +} + +# get_openstack_images() - Function that retrieves or builds docker images +function get_openstack_images { + if [[ "$build_image" == "True" ]]; then + install_python_package kolla + kolla-build --config-file $kolla_build + else + kolla-ansible pull -i $kolla_inventory + fi +} + +# deploy_openstack() - Function that provisions an OpenStack deployment +function deploy_openstack { + install_dependencies + configure_deploy ${1:-"192.168.53.0"} "True" - kolla-ansible pull -i all-in-one - kolla-ansible deploy -i all-in-one + get_openstack_images + kolla-ansible deploy -i $kolla_inventory kolla-ansible post-deploy echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc } -- cgit 1.2.3-korg