Skip to content

Instantly share code, notes, and snippets.

@cjloader
Created November 14, 2017 16:33
Show Gist options
  • Save cjloader/09f63772a3eb4c2af1d3b7ccc9b12d2e to your computer and use it in GitHub Desktop.
Save cjloader/09f63772a3eb4c2af1d3b7ccc9b12d2e to your computer and use it in GitHub Desktop.
diff --git a/doc/rpc-ironic/post-deploy-rpc-ironic.rst b/doc/rpc-ironic/post-deploy-rpc-ironic.rst
index bf03ffd..93d8a4a 100644
--- a/doc/rpc-ironic/post-deploy-rpc-ironic.rst
+++ b/doc/rpc-ironic/post-deploy-rpc-ironic.rst
@@ -25,137 +25,26 @@ To create images for ironic, you must use the
This deployment requires raid tools for HP gear. The ``IRONIC_AGENT_VERSION``
variable can be set to any stable branch, Ocata or later.
- .. code-block:: console
+ You need to clone `rpc-integration <https://github.com/rcbops/rpc-integration>` repo to
+ `` /opt/rpc-integration/ `` as it contains resources that are needed.
- #!/usr/bin/env bash
+ For Ubuntu Trusty and Xenial:
+
+ From the `` /opt/rpc-integration/rpc-ironic/scripts/ `` directory, run
+ `` generate-ubuntu.sh ``. This script will create the as well as
+ the baremetal Xenial/Trusty images.
+
+ For CentOS 7:
+
+ There are two different scripts based the hardware, one for HP and the other
+ for Dell.
+
+ To create the HP image, from the `` /opt/rpc-integration/rpc-ironic/scripts/ ``,
+ run the `` gen-centos-hp.sh `` script. This uses `` eureka-element `` found in
+ `` /opt/rpc-integration/rpc-ironic/custom-element/ `` which provides additional
+ network configurations in the image.
- set -e
-
- function cleanup {
- # it's ok if we have some errors on cleanup
- set +e
- unset DIB_DEV_USER_USERNAME DIB_DEV_USER_PASSWORD DIB_DEV_USER_PWDLESS_SUDO
- unset ELEMENTS_PATH DIB_CLOUD_INIT_DATASOURCES DIB_RELEASE DISTRO_NAME
- unset DIB_HPSSACLI_URL IRONIC_AGENT_VERSION
- unset -f make-base-image
- unset -f cleanup
- deactivate
- }
- # clean up our variables on exit, even exit on error
- trap cleanup EXIT
-
- function make-base-image
- {
- disk-image-create -o baremetal-$DISTRO_NAME-$DIB_RELEASE $DISTRO_NAME baremetal bootloader local-config dhcp-all-interfaces bootloader proliant-tools
-
- rm -R *.d/
- scp -o StrictHostKeyChecking=no baremetal-$DISTRO_NAME-$DIB_RELEASE* "${UTILITY01_HOSTNAME}":~/images
- rm baremetal-$DISTRO_NAME-$DIB_RELEASE* # no reason to keep these around
-
- VMLINUZ_UUID=$(ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "source ~/openrc; glance image-create --name baremetal-$DISTRO_NAME-$DIB_RELEASE.vmlinuz \
- --visibility public \
- --disk-format aki \
- --property hypervisor_type=baremetal \
- --protected=True \
- --container-format aki < ~/images/baremetal-$DISTRO_NAME-$DIB_RELEASE.vmlinuz" | awk '/\| id/ {print $4}')
- INITRD_UUID=$(ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "source ~/openrc; glance image-create --name baremetal-$DISTRO_NAME-$DIB_RELEASE.initrd \
- --visibility public \
- --disk-format ari \
- --property hypervisor_type=baremetal \
- --protected=True \
- --container-format ari < ~/images/baremetal-$DISTRO_NAME-$DIB_RELEASE.initrd" | awk '/\| id/ {print $4}')
- ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "source ~/openrc; glance image-create --name baremetal-$DISTRO_NAME-$DIB_RELEASE \
- --visibility public \
- --disk-format qcow2 \
- --container-format bare \
- --property hypervisor_type=baremetal \
- --property kernel_id=${VMLINUZ_UUID} \
- --protected=True \
- --property ramdisk_id=${INITRD_UUID} < ~/images/baremetal-$DISTRO_NAME-$DIB_RELEASE.qcow2"
- }
-
- # install needed binaries
- apt-get install -y kpartx parted qemu-utils
-
- mkdir -p ~/dib
- pushd ~/dib
- virtualenv env
- source env/bin/activate
-
- # newton pip.conf sucks
- if [[ -f ~/.pip/pip.conf ]]; then
- mv ~/.pip/pip.conf{,.bak}
- fi
- # install dib
- pip install pbr # newton pbr is too old
- if [[ ! -d ~/dib/diskimage-builder ]]; then
- git clone https://github.com/openstack/diskimage-builder/
- fi
- # let's use a new kernel
- if ! grep -q linux-image-generic-lts-xenial ~/dib/diskimage-builder/diskimage_builder/elements/ubuntu/package-installs.yaml; then
- echo 'linux-image-generic-lts-xenial:' > ~/dib/diskimage-builder/diskimage_builder/elements/ubuntu/package-installs.yaml
- fi
- pushd diskimage-builder
- pip install .
- popd
- if [[ -f ~/.pip/pip.conf.bak ]]; then
- mv ~/.pip/pip.conf.bak ~/.pip/pip.conf
- fi
-
- UTILITY01_HOSTNAME=$(grep infra01_util /etc/hosts | awk '{print $NF}')
-
- # create image directory in util01 container
- ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "mkdir -p ~/images"
-
- # set up envars for the deploy image debug user
- export DIB_DEV_USER_USERNAME=debug-user
- export DIB_DEV_USER_PASSWORD=secrete
- export DIB_DEV_USER_PWDLESS_SUDO=yes
-
- # set up envars for the deploy image ironic agent
- export IRONIC_AGENT_VERSION="stable/ocata"
- # create the deploy image
- disk-image-create --install-type source -o ironic-deploy ironic-agent fedora devuser proliant-tools
-
- rm ironic-deploy.vmlinuz # not needed or uploaded
- rm -R *.d/ # don't need dib dirs
- scp -o StrictHostKeyChecking=no ironic-deploy* "${UTILITY01_HOSTNAME}":~/images
- rm ironic-deploy* # no reason to keep these around
-
- ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "source ~/openrc; glance image-create --name ironic-deploy.kernel \
- --visibility private \
- --disk-format aki \
- --property hypervisor_type=baremetal \
- --protected=True \
- --container-format aki < ~/images/ironic-deploy.kernel"
- ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "source ~/openrc; glance image-create --name ironic-deploy.initramfs \
- --visibility private \
- --disk-format ari \
- --property hypervisor_type=baremetal \
- --protected=True \
- --container-format ari < ~/images/ironic-deploy.initramfs"
-
- unset DIB_DEV_USER_USERNAME DIB_DEV_USER_PASSWORD DIB_DEV_USER_PWDLESS_SUDO
-
- #Ubuntu Xenial
- export DIB_CLOUD_INIT_DATASOURCES="Ec2, ConfigDrive, OpenStack"
- export DIB_RELEASE=xenial
- export DISTRO_NAME=ubuntu
- make-base-image
-
- #Ubuntu Trusty
- export DIB_RELEASE=trusty
- export DISTRO_NAME=ubuntu
- make-base-image
-
- #CentOS 7
- export DIB_RELEASE=7
- export DISTRO_NAME=centos7
- make-base-image
- popd
-
- # utility container doesn't have much space...
- ssh -o StrictHostKeyChecking=no "${UTILITY01_HOSTNAME}" "rm ~/images -R"
+ The Dell is similar to the HP, just run `` gen-centos-dell.sh ``.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment