4 LIBDIR="$(dirname "$PWD")"
6 source $LIBDIR/lib/logging.sh
7 source $LIBDIR/lib/common.sh
9 if [[ $EUID -ne 0 ]]; then
10 echo "launch script must be run as root"
14 function install_ironic_container {
15 # set password for mariadb
16 mariadb_password=$(echo $(date;hostname)|sha256sum |cut -c-20)
18 # Start image downloader container
19 docker run -d --net host --privileged --name ipa-downloader \
20 --env-file "${PWD}/ironic.env" \
21 -v "$IRONIC_DATA_DIR:/shared" "${IPA_DOWNLOADER_IMAGE}" /usr/local/bin/get-resource.sh
23 docker wait ipa-downloader
25 if [ ! -e "$IRONIC_DATA_DIR/html/images/ironic-python-agent.kernel" ] ||
26 [ ! -e "$IRONIC_DATA_DIR/html/images/ironic-python-agent.initramfs" ]; then
27 echo "Failed to get ironic-python-agent"
31 # Start dnsmasq, http, mariadb, and ironic containers using same image
32 # See this file for env vars you can set, like IP, DHCP_RANGE, INTERFACE
33 docker run -d --net host --privileged --name dnsmasq \
34 --env-file "${PWD}/ironic.env" \
35 -v "$IRONIC_DATA_DIR:/shared" --entrypoint /bin/rundnsmasq "${IRONIC_IMAGE}"
37 # For available env vars, see:
38 docker run -d --net host --privileged --name httpd \
39 --env-file "${PWD}/ironic.env" \
40 -v "$IRONIC_DATA_DIR:/shared" --entrypoint /bin/runhttpd "${IRONIC_IMAGE}"
42 # https://github.com/metal3-io/ironic/blob/master/runmariadb.sh
43 docker run -d --net host --privileged --name mariadb \
44 --env-file "${PWD}/ironic.env" \
45 -v "$IRONIC_DATA_DIR:/shared" --entrypoint /bin/runmariadb \
46 --env "MARIADB_PASSWORD=$mariadb_password" "${IRONIC_IMAGE}"
48 # See this file for additional env vars you may want to pass, like IP and INTERFACE
49 docker run -d --net host --privileged --name ironic \
50 --env-file "${PWD}/ironic.env" \
51 --env "MARIADB_PASSWORD=$mariadb_password" \
52 -v "$IRONIC_DATA_DIR:/shared" "${IRONIC_IMAGE}"
54 # Start Ironic Inspector
55 docker run -d --net host --privileged --name ironic-inspector \
56 --env-file "${PWD}/ironic.env" \
57 -v "$IRONIC_DATA_DIR:/shared" "${IRONIC_INSPECTOR_IMAGE}"
60 function create_ironic_env {
61 cat <<EOF > ${PWD}/ironic.env
62 PROVISIONING_INTERFACE=provisioning
63 DHCP_RANGE=172.22.0.10,172.22.0.100
64 IPA_BASEURI=https://images.rdoproject.org/train/rdo_trunk/current-tripleo
65 DEPLOY_KERNEL_URL=http://172.22.0.1/images/ironic-python-agent.kernel
66 DEPLOY_RAMDISK_URL=http://172.22.0.1/images/ironic-python-agent.initramfs
67 IRONIC_ENDPOINT=http://172.22.0.1:6385/v1/
68 IRONIC_INSPECTOR_ENDPOINT=http://172.22.0.1:5050/v1/
69 CACHEURL=http://172.22.0.1/images
70 IRONIC_FAST_TRACK=false
76 install_ironic_container
79 if [ "$#" -eq 0 ]; then
81 elif [ "$1" == "-o" ]; then