# Setup networking on provisioned hosts (Adapt setup_network.sh according to your network setup)
setup_network() {
-# Set Upper limit of number nodes in RI2 cluster (starting from 0)
-NODE_MAX_ID=$(($(yq r "$CURRENTPATH"/hw_config/"$VENDOR"/idf.yaml --length idf.kubespray.hostnames)-1))
-
-for idx in $(seq 0 "$NODE_MAX_ID")
-do
- NODE_IP=$(get_host_pxe_ip "nodes[${idx}]")
-# SSH to jumphost
- # shellcheck disable=SC2087
- ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << EOF
+ # Set Upper limit of number nodes in RI2 cluster (starting from 0)
+ NODE_MAX_ID=$(($(yq r "$CURRENTPATH"/hw_config/"$VENDOR"/idf.yaml --length idf.kubespray.hostnames)-1))
+
+ for idx in $(seq 0 "$NODE_MAX_ID"); do
+ NODE_IP=$(get_host_pxe_ip "nodes[${idx}]")
+ # SSH to jumphost
+ # shellcheck disable=SC2087
+ ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << EOF
ssh -o StrictHostKeyChecking=no root@${NODE_IP} \
'bash -s' < ${PROJECT_ROOT}/${VENDOR}/setup_network.sh
EOF
-done
+ done
}
# k8s Provisioning (currently BMRA)
ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/cluster.yml
EOF
}
+
+# Executes a specific Ansible playbook
+run_playbook() {
+ ansible_cmd="$(command -v ansible-playbook)"
+ ansible_cmd+=" -i $CURRENTPATH/inventory/localhost.ini"
+ ansible_cmd+=" -e ansible_python_interpreter=$(command -v python)"
+ if [ "${DEBUG:-false}" == "true" ]; then
+ ansible_cmd+=" -vvv"
+ fi
+ eval "$ansible_cmd $CURRENTPATH/playbooks/${1}.yaml"
+}