| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,12 @@ |
| 0 |
+Listen %PUBLICPORT% |
|
| 1 |
+ |
|
| 2 |
+<VirtualHost *:%PUBLICPORT%> |
|
| 3 |
+ DocumentRoot "%HTTPROOT%" |
|
| 4 |
+ <Directory "%HTTPROOT%"> |
|
| 5 |
+ Options Indexes FollowSymLinks |
|
| 6 |
+ AllowOverride None |
|
| 7 |
+ Order allow,deny |
|
| 8 |
+ Allow from all |
|
| 9 |
+ Require all granted |
|
| 10 |
+ </Directory> |
|
| 11 |
+</VirtualHost> |
| ... | ... |
@@ -93,6 +93,32 @@ IRONIC_HOSTPORT=${IRONIC_HOSTPORT:-$SERVICE_HOST:6385}
|
| 93 | 93 |
# Tell Tempest this project is present |
| 94 | 94 |
TEMPEST_SERVICES+=,ironic |
| 95 | 95 |
|
| 96 |
+# Enable iPXE |
|
| 97 |
+IRONIC_IPXE_ENABLED=$(trueorfalse False $IRONIC_IPXE_ENABLED) |
|
| 98 |
+IRONIC_HTTP_DIR=${IRONIC_HTTP_DIR:-$IRONIC_DATA_DIR/httpboot}
|
|
| 99 |
+IRONIC_HTTP_SERVER=${IRONIC_HTTP_SERVER:-$HOST_IP}
|
|
| 100 |
+IRONIC_HTTP_PORT=${IRONIC_HTTP_PORT:-8088}
|
|
| 101 |
+ |
|
| 102 |
+# get_pxe_boot_file() - Get the PXE/iPXE boot file path |
|
| 103 |
+function get_pxe_boot_file {
|
|
| 104 |
+ local relpath=syslinux/pxelinux.0 |
|
| 105 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 106 |
+ relpath=ipxe/undionly.kpxe |
|
| 107 |
+ fi |
|
| 108 |
+ |
|
| 109 |
+ local pxe_boot_file |
|
| 110 |
+ if is_ubuntu; then |
|
| 111 |
+ pxe_boot_file=/usr/lib/$relpath |
|
| 112 |
+ elif is_fedora || is_suse; then |
|
| 113 |
+ pxe_boot_file=/usr/share/$relpath |
|
| 114 |
+ fi |
|
| 115 |
+ |
|
| 116 |
+ echo $pxe_boot_file |
|
| 117 |
+} |
|
| 118 |
+ |
|
| 119 |
+# PXE boot image |
|
| 120 |
+IRONIC_PXE_BOOT_IMAGE=${IRONIC_PXE_BOOT_IMAGE:-$(get_pxe_boot_file)}
|
|
| 121 |
+ |
|
| 96 | 122 |
|
| 97 | 123 |
# Functions |
| 98 | 124 |
# --------- |
| ... | ... |
@@ -114,6 +140,10 @@ function install_ironic {
|
| 114 | 114 |
done |
| 115 | 115 |
git_clone $IRONIC_REPO $IRONIC_DIR $IRONIC_BRANCH |
| 116 | 116 |
setup_develop $IRONIC_DIR |
| 117 |
+ |
|
| 118 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 119 |
+ install_apache_wsgi |
|
| 120 |
+ fi |
|
| 117 | 121 |
} |
| 118 | 122 |
|
| 119 | 123 |
# install_ironicclient() - Collect sources and prepare |
| ... | ... |
@@ -123,6 +153,25 @@ function install_ironicclient {
|
| 123 | 123 |
sudo install -D -m 0644 -o $STACK_USER {$IRONICCLIENT_DIR/tools/,/etc/bash_completion.d/}ironic.bash_completion
|
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 |
+# _cleanup_ironic_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file |
|
| 127 |
+function _cleanup_ironic_apache_wsgi {
|
|
| 128 |
+ sudo rm -rf $IRONIC_HTTP_DIR |
|
| 129 |
+ disable_apache_site ironic |
|
| 130 |
+ sudo rm -f $(apache_site_config_for ironic) |
|
| 131 |
+ restart_apache_server |
|
| 132 |
+} |
|
| 133 |
+ |
|
| 134 |
+# _config_ironic_apache_wsgi() - Set WSGI config files of Ironic |
|
| 135 |
+function _config_ironic_apache_wsgi {
|
|
| 136 |
+ local ironic_apache_conf=$(apache_site_config_for ironic) |
|
| 137 |
+ sudo cp $FILES/apache-ironic.template $ironic_apache_conf |
|
| 138 |
+ sudo sed -e " |
|
| 139 |
+ s|%PUBLICPORT%|$IRONIC_HTTP_PORT|g; |
|
| 140 |
+ s|%HTTPROOT%|$IRONIC_HTTP_DIR|g; |
|
| 141 |
+ " -i $ironic_apache_conf |
|
| 142 |
+ enable_apache_site ironic |
|
| 143 |
+} |
|
| 144 |
+ |
|
| 126 | 145 |
# cleanup_ironic() - Remove residual data files, anything left over from previous |
| 127 | 146 |
# runs that would need to clean up. |
| 128 | 147 |
function cleanup_ironic {
|
| ... | ... |
@@ -135,22 +184,24 @@ function configure_ironic_dirs {
|
| 135 | 135 |
if [[ ! -d $IRONIC_CONF_DIR ]]; then |
| 136 | 136 |
sudo mkdir -p $IRONIC_CONF_DIR |
| 137 | 137 |
fi |
| 138 |
+ |
|
| 139 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 140 |
+ sudo mkdir -p $IRONIC_HTTP_DIR |
|
| 141 |
+ sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_HTTP_DIR |
|
| 142 |
+ fi |
|
| 143 |
+ |
|
| 138 | 144 |
sudo mkdir -p $IRONIC_DATA_DIR |
| 139 | 145 |
sudo mkdir -p $IRONIC_STATE_PATH |
| 140 | 146 |
sudo mkdir -p $IRONIC_TFTPBOOT_DIR |
| 141 | 147 |
sudo chown -R $STACK_USER $IRONIC_DATA_DIR $IRONIC_STATE_PATH |
| 142 | 148 |
sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR |
| 143 |
- if is_ubuntu; then |
|
| 144 |
- local pxebin=/usr/lib/syslinux/pxelinux.0 |
|
| 145 |
- elif is_fedora; then |
|
| 146 |
- local pxebin=/usr/share/syslinux/pxelinux.0 |
|
| 147 |
- fi |
|
| 148 |
- if [ ! -f $pxebin ]; then |
|
| 149 |
- die $LINENO "pxelinux.0 (from SYSLINUX) not found." |
|
| 149 |
+ mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg |
|
| 150 |
+ |
|
| 151 |
+ if [ ! -f $IRONIC_PXE_BOOT_IMAGE ]; then |
|
| 152 |
+ die $LINENO "PXE boot file $IRONIC_PXE_BOOT_IMAGE not found." |
|
| 150 | 153 |
fi |
| 151 | 154 |
|
| 152 |
- cp $pxebin $IRONIC_TFTPBOOT_DIR |
|
| 153 |
- mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg |
|
| 155 |
+ cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR |
|
| 154 | 156 |
} |
| 155 | 157 |
|
| 156 | 158 |
# configure_ironic() - Set config files, create data dirs, etc |
| ... | ... |
@@ -179,6 +230,10 @@ function configure_ironic {
|
| 179 | 179 |
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
| 180 | 180 |
setup_colorized_logging $IRONIC_CONF_FILE DEFAULT |
| 181 | 181 |
fi |
| 182 |
+ |
|
| 183 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]]; then |
|
| 184 |
+ _config_ironic_apache_wsgi |
|
| 185 |
+ fi |
|
| 182 | 186 |
} |
| 183 | 187 |
|
| 184 | 188 |
# configure_ironic_api() - Is used by configure_ironic(). Performs |
| ... | ... |
@@ -238,6 +293,15 @@ function configure_ironic_conductor {
|
| 238 | 238 |
iniset $IRONIC_CONF_FILE agent agent_pxe_append_params "nofb nomodeset vga=normal console=ttyS0" |
| 239 | 239 |
fi |
| 240 | 240 |
fi |
| 241 |
+ |
|
| 242 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 243 |
+ local pxebin=`basename $IRONIC_PXE_BOOT_IMAGE` |
|
| 244 |
+ iniset $IRONIC_CONF_FILE pxe ipxe_enabled True |
|
| 245 |
+ iniset $IRONIC_CONF_FILE pxe pxe_config_template '\$pybasedir/drivers/modules/ipxe_config.template' |
|
| 246 |
+ iniset $IRONIC_CONF_FILE pxe pxe_bootfile_name $pxebin |
|
| 247 |
+ iniset $IRONIC_CONF_FILE pxe http_root $IRONIC_HTTP_DIR |
|
| 248 |
+ iniset $IRONIC_CONF_FILE pxe http_url "http://$IRONIC_HTTP_SERVER:$IRONIC_HTTP_PORT" |
|
| 249 |
+ fi |
|
| 241 | 250 |
} |
| 242 | 251 |
|
| 243 | 252 |
# create_ironic_cache_dir() - Part of the init_ironic() process |
| ... | ... |
@@ -305,6 +369,11 @@ function start_ironic {
|
| 305 | 305 |
if is_service_enabled ir-cond; then |
| 306 | 306 |
start_ironic_conductor |
| 307 | 307 |
fi |
| 308 |
+ |
|
| 309 |
+ # Start Apache if iPXE is enabled |
|
| 310 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 311 |
+ restart_apache_server |
|
| 312 |
+ fi |
|
| 308 | 313 |
} |
| 309 | 314 |
|
| 310 | 315 |
# start_ironic_api() - Used by start_ironic(). |
| ... | ... |
@@ -329,6 +398,11 @@ function stop_ironic {
|
| 329 | 329 |
# Kill the Ironic screen windows |
| 330 | 330 |
screen -S $SCREEN_NAME -p ir-api -X kill |
| 331 | 331 |
screen -S $SCREEN_NAME -p ir-cond -X kill |
| 332 |
+ |
|
| 333 |
+ # Cleanup the WSGI files |
|
| 334 |
+ if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then |
|
| 335 |
+ _cleanup_ironic_apache_wsgi |
|
| 336 |
+ fi |
|
| 332 | 337 |
} |
| 333 | 338 |
|
| 334 | 339 |
function is_ironic {
|
| ... | ... |
@@ -436,15 +510,6 @@ function configure_iptables {
|
| 436 | 436 |
} |
| 437 | 437 |
|
| 438 | 438 |
function configure_tftpd {
|
| 439 |
- if is_ubuntu; then |
|
| 440 |
- local pxebin=/usr/lib/syslinux/pxelinux.0 |
|
| 441 |
- elif is_fedora; then |
|
| 442 |
- local pxebin=/usr/share/syslinux/pxelinux.0 |
|
| 443 |
- fi |
|
| 444 |
- if [ ! -f $pxebin ]; then |
|
| 445 |
- die $LINENO "pxelinux.0 (from SYSLINUX) not found." |
|
| 446 |
- fi |
|
| 447 |
- |
|
| 448 | 439 |
# stop tftpd and setup serving via xinetd |
| 449 | 440 |
stop_service tftpd-hpa || true |
| 450 | 441 |
[ -f /etc/init/tftpd-hpa.conf ] && echo "manual" | sudo tee /etc/init/tftpd-hpa.override |