diff options
author | Dan Radez <dradez@redhat.com> | 2015-12-15 15:44:01 -0500 |
---|---|---|
committer | Dan Radez <dradez@redhat.com> | 2015-12-18 13:29:07 -0500 |
commit | f79e4a1703ba54008e7049b041600546e0482f75 (patch) | |
tree | f51fc992680709817d18589bc5b51ae5a9bb002b /ci | |
parent | 3011039e5e6308a88c28aa912de22f05355e5678 (diff) |
Adding network configuration options
- enabling subnet configuration for undercloud
- enabling external network configuration
Change-Id: Id1951d31faa1a68f850a75e2466d30b8abcea8ac
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/deploy.sh | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index 24187f16..d090280c 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -53,7 +53,7 @@ parse_yaml() { for (i in vname) {if (i > indent) {delete vname[i]}} if (length($3) > 0) { vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")} - printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3); + printf("%s%s%s=%s\n", "'$prefix'",vn, $2, $3); } }' } @@ -401,7 +401,7 @@ function setup_virtual_baremetal { ##Copy over the glance images and instack json file ##params: none -function copy_materials_to_instack { +function configure_undercloud { echo echo "Copying configuration file and disk images to instack" @@ -409,18 +409,6 @@ function copy_materials_to_instack { scp ${SSH_OPTIONS[@]} $NETENV "stack@$UNDERCLOUD": scp ${SSH_OPTIONS[@]} -r $CONFIG/nics/ "stack@$UNDERCLOUD": - if [[ ${#deploy_options_array[@]} -eq 0 || ${deploy_options_array['sdn_controller']} == 'opendaylight' ]]; then - DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml" - elif [ ${deploy_options_array['sdn_controller']} == 'opendaylight-external' ]; then - DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml" - elif [ ${deploy_options_array['sdn_controller']} == 'onos' ]; then - echo -e "${red}ERROR: ONOS is currently unsupported...exiting${reset}" - exit 1 - elif [ ${deploy_options_array['sdn_controller']} == 'opencontrail' ]; then - echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}" - exit 1 - fi - # ensure stack user on instack machine has an ssh key ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "if [ ! -e ~/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa; fi" @@ -466,15 +454,58 @@ sed -i 's~INSERT_STACK_USER_PRIV_KEY~'"\$stack_key"'~' instackenv.json EOI fi -# copy stack's ssh key to this users authorized keys -ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys + # copy stack's ssh key to this users authorized keys + ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys + + # configure undercloud on Undercloud VM + echo "Running undercloud configuration." + echo "Logging undercloud configuration to instack:/home/stack/apex-undercloud-install.log" + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI +if [ -n "$DEPLOY_SETTINGS_FILE" ]; then + sed -i 's/#local_ip/local_ip/' undercloud.conf + sed -i 's/#network_gateway/network_gateway/' undercloud.conf + sed -i 's/#network_cidr/network_cidr/' undercloud.conf + sed -i 's/#dhcp_start/dhcp_start/' undercloud.conf + sed -i 's/#dhcp_end/dhcp_end/' undercloud.conf + sed -i 's/#inspection_iprange/inspection_iprange/' undercloud.conf + sed -i 's/#undercloud_debug/undercloud_debug/' undercloud.conf + + openstack-config --set undercloud.conf DEFAULT local_ip ${deploy_options_array['instack_ip']}/${deploy_options_array['provisioning_cidr']##*/} + openstack-config --set undercloud.conf DEFAULT network_gateway ${deploy_options_array['provisioning_gateway']} + openstack-config --set undercloud.conf DEFAULT network_cidr ${deploy_options_array['provisioning_cidr']} + openstack-config --set undercloud.conf DEFAULT dhcp_start ${deploy_options_array['provisioning_dhcp_start']} + openstack-config --set undercloud.conf DEFAULT dhcp_end ${deploy_options_array['provisioning_dhcp_end']} + openstack-config --set undercloud.conf DEFAULT inspection_iprange ${deploy_options_array['provisioning_inspection_iprange']} + openstack-config --set undercloud.conf DEFAULT undercloud_debug false + + if [ -n "$net_isolation_enabled" ]; then + sed -i '/ControlPlaneSubnetCidr/c\\ ControlPlaneSubnetCidr: "${deploy_options_array['provisioning_cidr']##*/}"' network-environment.yaml + sed -i '/ControlPlaneDefaultRoute/c\\ ControlPlaneDefaultRoute: ${deploy_options_array['provisioning_gateway']}' network-environment.yaml + sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: ${deploy_options_array['ext_net_cidr']}' network-environment.yaml + sed -i '/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${deploy_options_array['ext_allocation_pool_start']}', 'end': '${deploy_options_array['ext_allocation_pool_end']}'}]' network-environment.yaml + sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: ${deploy_options_array['ext_gateway']}' network-environment.yaml + fi +fi + +openstack undercloud install &> apex-undercloud-install.log +EOI } ##preping it for deployment and launch the deploy ##params: none function undercloud_prep_overcloud_deploy { -# configure undercloud on Undercloud VM -ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "openstack undercloud install > apex-undercloud-install.log" + + if [[ ${#deploy_options_array[@]} -eq 0 || ${deploy_options_array['sdn_controller']} == 'opendaylight' ]]; then + DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml" + elif [ ${deploy_options_array['sdn_controller']} == 'opendaylight-external' ]; then + DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml" + elif [ ${deploy_options_array['sdn_controller']} == 'onos' ]; then + echo -e "${red}ERROR: ONOS is currently unsupported...exiting${reset}" + exit 1 + elif [ ${deploy_options_array['sdn_controller']} == 'opencontrail' ]; then + echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}" + exit 1 + fi # check if HA is enabled if [[ "$ha_enabled" == "TRUE" ]]; then @@ -639,7 +670,7 @@ main() { elif [ -n "$INVENTORY_FILE" ]; then parse_inventory_file fi - copy_materials_to_instack + configure_undercloud undercloud_prep_overcloud_deploy } |