summaryrefslogtreecommitdiffstats
path: root/xci/infra/bifrost/infra-provision.sh
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-05-04 23:11:35 +0200
committerMarkos Chandras <mchandras@suse.de>2018-06-28 20:03:00 +0100
commit3d4ac3786772ec23791183b4c54a9d6fd922752e (patch)
tree5754b70b800c6161a347f3847fe229c07f7f2029 /xci/infra/bifrost/infra-provision.sh
parentfd09da131991a99a886dd0c65969d30d81499511 (diff)
Use PDF to set up the XCI VMs
This patch is doing the first work item of the spec: https://github.com/opnfv/releng-xci/blob/master/docs/specs/infra_manager.rst It creates the required VMs by XCI to afterwards deploy the VIM. It does that by reading the pdf provided by the user. - It is currently assumed that the OS for the VM will be installed in the first disk of the node described by the pdf - It is assumed that the opnfv VM characteristics are not described in the pdf but in a similar document called opnfv_vm.yml - All references to csv from bifrost-create-vm-nodes were removed Change-Id: I46a85284e4ce7df21cbf66f66619b35f74251e68 Signed-off-by: Manuel Buil <mbuil@suse.com> Co-Authored-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'xci/infra/bifrost/infra-provision.sh')
-rw-r--r--xci/infra/bifrost/infra-provision.sh68
1 files changed, 63 insertions, 5 deletions
diff --git a/xci/infra/bifrost/infra-provision.sh b/xci/infra/bifrost/infra-provision.sh
index 9c3adfc2..17eb4158 100644
--- a/xci/infra/bifrost/infra-provision.sh
+++ b/xci/infra/bifrost/infra-provision.sh
@@ -1,3 +1,11 @@
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
#-------------------------------------------------------------------------------
# Start provisioning VM nodes
#-------------------------------------------------------------------------------
@@ -8,14 +16,64 @@
# - destroys VMs, removes ironic db, leases, logs
# - creates and provisions VMs for the chosen flavor
#-------------------------------------------------------------------------------
+
BIFROST_ROOT_DIR="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:${XCI_PATH}/xci/playbooks/roles:${XCI_CACHE}/repos/bifrost/playbooks/roles"
+export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${XCI_CACHE}/repos/bifrost/playbooks/library"
-echo "Info: Starting provisining VM nodes using openstack/bifrost"
+echo "Info: Create XCI VM resources"
echo "-------------------------------------------------------------------------"
-cd $BIFROST_ROOT_DIR/playbooks/
-ansible-playbook ${XCI_ANSIBLE_PARAMS} -i "localhost," bootstrap-bifrost.yml
-cd ${XCI_CACHE}/repos/bifrost
-bash ./scripts/bifrost-provision.sh
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ -e num_nodes=${NUM_NODES} \
+ -e vm_domain_type=${VM_DOMAIN_TYPE} \
+ -e baremetal_json_file=/tmp/baremetal.json \
+ -e xci_distro=${XCI_DISTRO} \
+ ${BIFROST_ROOT_DIR}/playbooks/xci-create-virtual.yml
+
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ --private-key=${XCI_PATH}/xci/scripts/vm/id_rsa_for_dib \
+ --user=devuser \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ ${BIFROST_ROOT_DIR}/playbooks/xci-prepare-virtual.yml
+
+source ${XCI_CACHE}/repos/bifrost/scripts/bifrost-env.sh
+
+# This is hardcoded to delegate to localhost but we really need to delegate to opnfv instead.
+sed -i "/delegate_to:/d" ${XCI_CACHE}/repos/bifrost/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ --user=devuser \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ -i ${XCI_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
+ -e use_cirros=false \
+ -e testing_user=root \
+ -e test_vm_num_nodes=${NUM_NODES} \
+ -e test_vm_cpu='host-model' \
+ -e inventory_dhcp=false \
+ -e inventory_dhcp_static_ip=false \
+ -e enable_inspector=true \
+ -e inspect_nodes=true \
+ -e download_ipa=true \
+ -e create_ipa_image=false \
+ -e write_interfaces_file=true \
+ -e ipv4_gateway=192.168.122.1 \
+ -e wait_timeout=3600 \
+ -e enable_keystone=false \
+ -e ironicinspector_source_install=true \
+ -e ironicinspector_git_branch=${BIFROST_IRONIC_INSPECTOR_VERSION:-master} \
+ -e ironicinspectorclient_source_install=true \
+ -e ironicinspectorclient_git_branch=${BIFROST_IRONIC_INSPECTOR_CLIENT_VERSION:-master} \
+ -e ironicclient_source_install=true \
+ -e ironicclient_git_branch=${BIFROST_IRONIC_CLIENT_VERSION:-master} \
+ -e ironic_git_branch=${BIFROST_IRONIC_VERSION:-master} \
+ -e use_prebuilt_images=${BIFROST_USE_PREBUILT_IMAGES:-false} \
+ -e xci_distro=${XCI_DISTRO} \
+ -e ironic_url="http://192.168.122.2:6385/" \
+ ${BIFROST_ROOT_DIR}/playbooks/opnfv-virtual.yml
+
echo "-----------------------------------------------------------------------"
echo "Info: VM nodes are provisioned!"
echo "-----------------------------------------------------------------------"