summaryrefslogtreecommitdiffstats
path: root/foreman
diff options
context:
space:
mode:
Diffstat (limited to 'foreman')
-rw-r--r--foreman/ci/Vagrantfile2
-rwxr-xr-xforeman/ci/deploy.sh86
2 files changed, 85 insertions, 3 deletions
diff --git a/foreman/ci/Vagrantfile b/foreman/ci/Vagrantfile
index a01da70..5550976 100644
--- a/foreman/ci/Vagrantfile
+++ b/foreman/ci/Vagrantfile
@@ -12,7 +12,7 @@ Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
- config.vm.box = "chef/centos-7.0"
+ config.vm.box = "opnfv/centos-7.0"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
diff --git a/foreman/ci/deploy.sh b/foreman/ci/deploy.sh
index 862077e..a978e38 100755
--- a/foreman/ci/deploy.sh
+++ b/foreman/ci/deploy.sh
@@ -448,8 +448,8 @@ install_vagrant() {
fi
##add centos 7 box to vagrant
- if ! vagrant box list | grep chef/centos-7.0; then
- if ! vagrant box add chef/centos-7.0 --provider virtualbox; then
+ if ! vagrant box list | grep opnfv/centos-7.0; then
+ if ! vagrant box add opnfv/centos-7.0 --provider virtualbox; then
printf '%s\n' 'deploy.sh: Unable to download centos7 box for Vagrant' >&2
exit 1
fi
@@ -732,6 +732,20 @@ configure_network() {
fi
fi
+ nodes=`sed -nr '/nodes:/{:start /workaround/!{N;b start};//p}' opnfv_ksgen_settings.yml | sed -n '/^ [A-Za-z0-9]\+:$/p' | sed 's/\s*//g' | sed 's/://g'`
+ controller_nodes=`echo $nodes | tr " " "\n" | grep controller | tr "\n" " "`
+ echo "${blue}Controller nodes found in settings: ${controller_nodes}${reset}"
+ my_controller_array=( $controller_nodes )
+ num_control_nodes=${#my_controller_array[@]}
+ if [ "$num_control_nodes" -ne 3 ]; then
+ if cat opnfv_ksgen_settings.yml | grep ha_flag | grep true; then
+ echo "${red}Error: You must define exactly 3 control nodes when HA flag is true!${reset}"
+ exit 1
+ fi
+ else
+ echo "${blue}Number of Controller nodes detected: ${num_control_nodes}${reset}"
+ fi
+
if [ $no_parse ]; then
echo "${blue}Skipping parsing variables into settings file as no_parse flag is set${reset}"
@@ -1137,11 +1151,79 @@ start_virtual_nodes() {
fi
}
+##check to make sure nodes are powered off
+##this function does nothing if virtual
+##params: none
+##usage: check_baremetal_nodes()
+check_baremetal_nodes() {
+ if [ $virtual ]; then
+ echo "${blue}Skipping Baremetal node power status check as deployment is virtual ${reset}"
+ else
+ echo "${blue}Checking Baremetal nodes power state... ${reset}"
+ if [ ! -z "$base_config" ]; then
+ # Install ipmitool
+ # Major version is pinned to force some consistency for Arno
+ if ! yum list installed | grep -i ipmitool; then
+ echo "${blue}Installing ipmitool...${reset}"
+ if ! yum -y install ipmitool-1*; then
+ echo "${red}Failed to install ipmitool!${reset}"
+ exit 1
+ fi
+ fi
+
+ ###find all the bmc IPs and number of nodes
+ node_counter=0
+ output=`grep bmc_ip $base_config | grep -Eo '[0-9]+.[0-9]+.[0-9]+.[0-9]+'`
+ for line in ${output} ; do
+ bmc_ip[$node_counter]=$line
+ ((node_counter++))
+ done
+
+ max_nodes=$((node_counter-1))
+
+ ###find bmc_users per node
+ node_counter=0
+ output=`grep bmc_user $base_config | sed 's/\s*bmc_user:\s*//'`
+ for line in ${output} ; do
+ bmc_user[$node_counter]=$line
+ ((node_counter++))
+ done
+
+ ###find bmc_pass per node
+ node_counter=0
+ output=`grep bmc_pass $base_config | sed 's/\s*bmc_pass:\s*//'`
+ for line in ${output} ; do
+ bmc_pass[$node_counter]=$line
+ ((node_counter++))
+ done
+
+ for mynode in `seq 0 $max_nodes`; do
+ echo "${blue}Node: ${bmc_ip[$mynode]} ${bmc_user[$mynode]} ${bmc_pass[$mynode]} ${reset}"
+ ipmi_output=`ipmitool -I lanplus -P ${bmc_pass[$mynode]} -U ${bmc_user[$mynode]} -H ${bmc_ip[$mynode]} chassis status \
+ | grep "System Power" | cut -d ':' -f2 | tr -d [:blank:]`
+ if [ "$ipmi_output" == "on" ]; then
+ echo "${red}Error: Node is powered on: ${bmc_ip[$mynode]} ${reset}"
+ echo "${red}Please run clean.sh before running deploy! ${reset}"
+ exit 1
+ elif [ "$ipmi_output" == "off" ]; then
+ echo "${blue}Node: ${bmc_ip[$mynode]} is powered off${reset}"
+ else
+ echo "${red}Warning: Unable to detect node power state: ${bmc_ip[$mynode]} ${reset}"
+ fi
+ done
+ else
+ echo "${red}base_config was not provided for a baremetal install! Exiting${reset}"
+ exit 1
+ fi
+ fi
+}
+
##END FUNCTIONS
main() {
parse_cmdline "$@"
disable_selinux
+ check_baremetal_nodes
install_EPEL
install_vbox
install_ansible