6 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9 # Get variables from the config file
10 if [ -z "${CONFIG:-}" ]; then
11 # See if there's a config_$USER.sh in the SCRIPTDIR
12 if [ ! -f ${SCRIPTDIR}/../config_${USER}.sh ]; then
13 cp ${SCRIPTDIR}/../config_example.sh ${SCRIPTDIR}/../config_${USER}.sh
14 echo "Automatically created config_${USER}.sh with default contents."
16 CONFIG="${SCRIPTDIR}/../config_${USER}.sh"
22 ADDN_DNS=${ADDN_DNS:-}
23 # External interface for routing traffic through the host
25 # Provisioning interface
27 # Does libvirt manage the baremetal bridge (including DNS and DHCP)
28 MANAGE_BR_BRIDGE=${MANAGE_BR_BRIDGE:-y}
29 # Only manage bridges if is set
30 MANAGE_PRO_BRIDGE=${MANAGE_PRO_BRIDGE:-y}
31 MANAGE_INT_BRIDGE=${MANAGE_INT_BRIDGE:-y}
32 # Internal interface, to bridge virbr0
34 #Root disk to deploy coreOS - use /dev/sda on BM
35 ROOT_DISK_NAME=${ROOT_DISK_NAME-"/dev/sda"}
37 CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"docker"}
39 export EXTERNAL_SUBNET="192.168.111.0/24"
40 #Ironic data directory
41 IRONIC_DATA_DIR=${IRONIC_DATA_DIR:-"/opt/ironic"}
42 export SSH_PUB_KEY=~/.ssh/id_rsa.pub
44 FILESYSTEM=${FILESYSTEM:="/"}
46 WORKING_DIR=${WORKING_DIR:-"/opt/metal3-vm"}
47 NODES_FILE=${NODES_FILE:-"${WORKING_DIR}/ironic_nodes.json"}
48 NODES_PLATFORM=${NODES_PLATFORM:-"libvirt"}
50 export NUM_MASTERS=${NUM_MASTERS:-"1"}
51 export NUM_WORKERS=${NUM_WORKERS:-"1"}
52 export VM_EXTRADISKS=${VM_EXTRADISKS:-"false"}
55 export IRONIC_IMAGE=${IRONIC_IMAGE:-"integratedcloudnative/ironic:v1.0-icn"}
56 export IRONIC_INSPECTOR_IMAGE=${IRONIC_INSPECTOR_IMAGE:-"integratedcloudnative/ironic-inspector:v1.0-icn"}
57 export IRONIC_BAREMETAL_IMAGE=${IRONIC_BAREMETAL_IMAGE:-"integratedcloudnative/baremetal-operator:v2.0-icn"}
58 export IPA_DOWNLOADER_IMAGE=${IPA_DOWNLOADER_IMAGE:-"integratedcloudnative/ironic-ipa-downloader:v1.0-icn"}
60 # Verify requisites/permissions
61 # Connect to system libvirt
62 export LIBVIRT_DEFAULT_URI=qemu:///system
63 if [ "$USER" != "root" -a "${XDG_RUNTIME_DIR:-}" == "/run/user/0" ] ; then
64 echo "Please use a non-root user, WITH a login shell (e.g. su - USER)"
68 # Check if sudo privileges without password
69 if ! sudo -n uptime &> /dev/null ; then
70 echo "sudo without password is required"
75 OS=$(awk -F= '/^ID=/ { print $2 }' /etc/os-release | tr -d '"')
76 if [[ ! $OS =~ ^(centos|rhel|ubuntu)$ ]]; then
81 # Check CentOS version
82 os_version=$(awk -F= '/^VERSION_ID=/ { print $2 }' /etc/os-release | tr -d '"' | cut -f1 -d'.')
83 if [[ ${os_version} -ne 7 ]] && [[ ${os_version} -ne 18 ]]; then
84 echo "Required CentOS 7 or RHEL 7 or Ubuntu 18.04"
88 # Check d_type support
89 FSTYPE=$(df ${FILESYSTEM} --output=fstype | grep -v Type)
95 if [[ $(xfs_info ${FILESYSTEM} | grep -q "ftype=1") ]]; then
96 echo "Filesystem not supported"
101 echo "Filesystem not supported"
106 if [ ! -d "$WORKING_DIR" ]; then
107 echo "Creating Working Dir"
108 sudo mkdir "$WORKING_DIR"
109 sudo chown "${USER}:${USER}" "$WORKING_DIR"
110 chmod 755 "$WORKING_DIR"
113 function list_nodes {
114 # Includes -machine and -machine-namespace
118 .driver + "://" + .driver_info.ipmi_address + (if .driver_info.ipmi_port then ":" + .driver_info.ipmi_port else "" end),
119 .driver_info.ipmi_username,
120 .driver_info.ipmi_password,