diff options
Diffstat (limited to 'mcp/reclass')
-rwxr-xr-x | mcp/reclass/scripts/create-config-drive.sh | 102 | ||||
-rwxr-xr-x | mcp/reclass/scripts/dpdk.sh | 16 | ||||
-rwxr-xr-x | mcp/reclass/scripts/infra.sh | 82 | ||||
-rw-r--r-- | mcp/reclass/scripts/net_internal.xml | 4 | ||||
-rw-r--r-- | mcp/reclass/scripts/net_mgmt.xml | 5 | ||||
-rw-r--r-- | mcp/reclass/scripts/net_public.xml | 6 | ||||
-rw-r--r-- | mcp/reclass/scripts/net_pxe.xml | 10 | ||||
-rwxr-xr-x | mcp/reclass/scripts/openstack.sh | 44 | ||||
-rwxr-xr-x | mcp/reclass/scripts/salt.sh | 23 | ||||
-rw-r--r-- | mcp/reclass/scripts/user-data.template | 10 |
10 files changed, 0 insertions, 302 deletions
diff --git a/mcp/reclass/scripts/create-config-drive.sh b/mcp/reclass/scripts/create-config-drive.sh deleted file mode 100755 index cf87150fc..000000000 --- a/mcp/reclass/scripts/create-config-drive.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash - -# This will generate a openstack-style config drive image suitable for -# use with cloud-init. You may optionally pass in an ssh public key -# (using the -k/--ssh-key option) and a user-data blog (using the -# -u/--user-data option). - -usage () { - echo "usage: ${0##*/}: [--ssh-key <pubkey>] [--vendor-data <file>] [--user-data <file>] [--hostname <hostname>] <imagename>" -} - -ARGS=$(getopt \ - -o k:u:v:h: \ - --long help,hostname:,ssh-key:,user-data:,vendor-data: -n ${0##*/} \ - -- "$@") - -if [ $? -ne 0 ]; then - usage >&2 - exit 2 -fi - -eval set -- "$ARGS" - -while :; do - case "$1" in - --help) - usage - exit 0 - ;; - -k|--ssh-key) - ssh_key="$2" - shift 2 - ;; - -u|--user-data) - user_data="$2" - shift 2 - ;; - -v|--vendor-data) - vendor_data="$2" - shift 2 - ;; - -h|--hostname) - hostname="$2" - shift 2 - ;; - --) shift - break - ;; - esac -done - -config_image=$1 -shift - -if [ "$ssh_key" ] && [ -f "$ssh_key" ]; then - echo "adding pubkey from $ssh_key" - ssh_key_data=$(cat "$ssh_key") -fi - -uuid=$(uuidgen) -if ! [ "$hostname" ]; then - hostname="$uuid" -fi - -trap 'rm -rf $config_dir' EXIT -config_dir=$(mktemp -t -d configXXXXXX) - -if [ "$user_data" ] && [ -f "$user_data" ]; then - echo "adding user data from $user_data" - cp $user_data $config_dir/user-data -else - touch $config_dir/user-data -fi - -if [ "$vendor_data" ] && [ -f "$vendor_data" ]; then - echo "adding vendor data from $vendor_data" - cp $vendor_data $config_dir/vendor-data -fi - -cat > $config_dir/meta-data <<-EOF -instance-id: $uuid -hostname: $hostname -local-hostname: $hostname -EOF - -if [ "$ssh_key_data" ]; then - cat >> $config_dir/meta-data <<-EOF - public-keys: - - | - $ssh_key_data - EOF -fi - -#PS1="debug> " bash --norc - -echo "generating configuration image at $config_image" -if ! mkisofs -o $config_image -V cidata -r -J --quiet $config_dir; then - echo "ERROR: failed to create $config_image" >&2 - exit 1 -fi -chmod a+r $config_image - diff --git a/mcp/reclass/scripts/dpdk.sh b/mcp/reclass/scripts/dpdk.sh deleted file mode 100755 index 4e4cd0b2a..000000000 --- a/mcp/reclass/scripts/dpdk.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Enable DPDK on compute nodes -# - -ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << DPDK_INSTALL_END - sudo -i - - salt -C 'I@nova:compute' system.reboot - salt -C 'I@nova:compute' test.ping - - salt -C 'I@nova:compute' state.sls linux - salt -C 'I@nova:compute' state.sls nova,neutron - - salt -C 'I@keystone:server and *01*' cmd.run ". /root/keystonercv3; nova service-list; openstack network agent list" -DPDK_INSTALL_END diff --git a/mcp/reclass/scripts/infra.sh b/mcp/reclass/scripts/infra.sh deleted file mode 100755 index 72ad5aa5a..000000000 --- a/mcp/reclass/scripts/infra.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -BASE_IMAGE=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -declare -A NODES=( [cfg01]=4096 [ctl01]=14336 [gtw01]=2048 [cmp01]=6144 [cmp02]=6144 ) - -# get required packages -apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm - -# generate ssh key -[ -f $SSH_KEY ] || ssh-keygen -f $SSH_KEY -N '' -install -o jenkins -m 0600 ${SSH_KEY} /tmp/ - -# get base image -mkdir -p images -wget -P /tmp -nc $BASE_IMAGE - -# generate cloud-init user data -envsubst < user-data.template > user-data.sh - -for node in "${!NODES[@]}"; do - # clean up existing nodes - if [ "$(virsh domstate $node 2>/dev/null)" == 'running' ]; then - virsh destroy $node - virsh undefine $node - fi - - # create/prepare images - [ -f images/mcp_${node}.iso ] || ./create-config-drive.sh -k ${SSH_KEY}.pub -u user-data.sh -h ${node} images/mcp_${node}.iso - cp /tmp/${BASE_IMAGE/*\/} images/mcp_${node}.qcow2 - qemu-img resize images/mcp_${node}.qcow2 100G -done - -# create required networks -for net in pxe mgmt internal public; do - if virsh net-info $net >/dev/null 2>&1; then - virsh net-destroy ${net} - virsh net-undefine ${net} - fi - virsh net-define net_${net}.xml - virsh net-autostart ${net} - virsh net-start ${net} -done - -# create vms with specified options -for node in "${!NODES[@]}"; do - virt-install --name ${node} --ram ${NODES[$node]} --vcpus=2 --cpu host --accelerate \ - --network network:pxe,model=virtio \ - --network network:mgmt,model=virtio \ - --network network:internal,model=virtio \ - --network network:public,model=virtio \ - --disk path=$(pwd)/images/mcp_${node}.qcow2,format=qcow2,bus=virtio,cache=none,io=native \ - --os-type linux --os-variant none \ - --boot hd --vnc --console pty --autostart --noreboot \ - --disk path=$(pwd)/images/mcp_${node}.iso,device=cdrom -done - -# set static ip address for salt master node -virsh net-update pxe add ip-dhcp-host \ -"<host mac='$(virsh domiflist cfg01 | awk '/pxe/ {print $5}')' name='cfg01' ip='$SALT_MASTER'/>" --live - -# start vms -for node in "${!NODES[@]}"; do - virsh start ${node} - sleep $[RANDOM%5+1] -done - -CONNECTION_ATTEMPTS=60 -SLEEP=5 - -# wait until ssh on Salt master is available -echo "Attempting to ssh to Salt master ..." -ATTEMPT=1 - -while (($ATTEMPT <= $CONNECTION_ATTEMPTS)); do - ssh $SSH_OPTS ubuntu@$SALT_MASTER uptime - case $? in - (0) echo "${ATTEMPT}> Success"; break ;; - (*) echo "${ATTEMPT}/${CONNECTION_ATTEMPTS}> ssh server ain't ready yet, waiting for ${SLEEP} seconds ..." ;; - esac - sleep $SLEEP - ((ATTEMPT+=1)) -done diff --git a/mcp/reclass/scripts/net_internal.xml b/mcp/reclass/scripts/net_internal.xml deleted file mode 100644 index a9abece70..000000000 --- a/mcp/reclass/scripts/net_internal.xml +++ /dev/null @@ -1,4 +0,0 @@ -<network> - <name>internal</name> - <bridge name="internal"/> -</network> diff --git a/mcp/reclass/scripts/net_mgmt.xml b/mcp/reclass/scripts/net_mgmt.xml deleted file mode 100644 index 0ba613152..000000000 --- a/mcp/reclass/scripts/net_mgmt.xml +++ /dev/null @@ -1,5 +0,0 @@ -<network> - <name>mgmt</name> - <bridge name="mgmt"/> - <ip address="172.16.10.1" netmask="255.255.255.0"/> -</network> diff --git a/mcp/reclass/scripts/net_public.xml b/mcp/reclass/scripts/net_public.xml deleted file mode 100644 index 61650d5a6..000000000 --- a/mcp/reclass/scripts/net_public.xml +++ /dev/null @@ -1,6 +0,0 @@ -<network> - <name>public</name> - <bridge name="public"/> - <forward mode="nat"/> - <ip address="10.16.0.1" netmask="255.255.255.0" /> -</network> diff --git a/mcp/reclass/scripts/net_pxe.xml b/mcp/reclass/scripts/net_pxe.xml deleted file mode 100644 index 92eaa6b52..000000000 --- a/mcp/reclass/scripts/net_pxe.xml +++ /dev/null @@ -1,10 +0,0 @@ -<network> - <name>pxe</name> - <bridge name="pxe"/> - <forward mode="nat"/> - <ip address="192.168.10.1" netmask="255.255.255.0"> - <dhcp> - <range start="192.168.10.100" end="192.168.10.254"/> - </dhcp> - </ip> -</network> diff --git a/mcp/reclass/scripts/openstack.sh b/mcp/reclass/scripts/openstack.sh deleted file mode 100755 index 9e636ddaa..000000000 --- a/mcp/reclass/scripts/openstack.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# Deploy Openstack -# - -ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << OPENSTACK_INSTALL_END - sudo -i - - salt-call state.apply salt - salt '*' state.apply salt || salt '*' state.apply salt - - salt -C 'I@salt:master' state.sls linux - salt -C '* and not cfg01*' state.sls linux - - salt '*' state.sls ntp - - salt -C 'I@rabbitmq:server' state.sls rabbitmq - salt -C 'I@rabbitmq:server' cmd.run "rabbitmqctl status" - - salt -C 'I@mysql:server' state.sls mysql - - salt -C 'I@memcached:server' state.sls memcached - - salt -C 'I@keystone:server' state.sls keystone.server - salt -C 'I@keystone:server' cmd.run "systemctl restart apache2" - while true; do salt -C 'I@keystone:server' state.sls keystone.client && break; done - salt -C 'I@keystone:server' cmd.run ". /root/keystonercv3; openstack service list" - - salt -C 'I@glance:server' state.sls glance - salt -C 'I@nova:controller' state.sls nova - salt -C 'I@heat:server' state.sls heat - salt -C 'I@cinder:controller' state.sls cinder - - salt -C 'I@neutron:server' state.sls neutron - salt -C 'I@neutron:gateway' state.sls neutron - - salt -C 'I@nova:compute' state.sls nova - salt -C 'I@neutron:compute' state.sls neutron - - salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume list" - - salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --share --external --provider-network-type flat --provider-physical-network physnet1 floating_net" - salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet" -OPENSTACK_INSTALL_END diff --git a/mcp/reclass/scripts/salt.sh b/mcp/reclass/scripts/salt.sh deleted file mode 100755 index 3b6fa9900..000000000 --- a/mcp/reclass/scripts/salt.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Deploy Salt Master -# - -# ssh to cfg01 -ssh $SSH_OPTS ubuntu@$SALT_MASTER bash -s << SALT_INSTALL_END - sudo -i - - echo -n 'Checking out cloud-init has finished running ...' - while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done - echo ' done' - - apt-get install -y git curl subversion - - svn export --force https://github.com/salt-formulas/salt-formulas/trunk/deploy/scripts /srv/salt/scripts - git clone --depth=1 --recurse-submodules https://git.opnfv.org/fuel - ln -s /root/fuel/mcp/reclass /srv/salt/reclass - - cd /srv/salt/scripts - MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh - salt-key -Ay -SALT_INSTALL_END diff --git a/mcp/reclass/scripts/user-data.template b/mcp/reclass/scripts/user-data.template deleted file mode 100644 index 811a58c70..000000000 --- a/mcp/reclass/scripts/user-data.template +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add - -echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main" > /etc/apt/sources.list.d/salt.list -apt update -apt-get install -y salt-minion -rm /etc/salt/minion_id -rm -f /etc/salt/pki/minion/minion_master.pub -echo "id: $(hostname).${CLUSTER_DOMAIN}" > /etc/salt/minion -echo "master: ${SALT_MASTER}" >> /etc/salt/minion -service salt-minion restart |