ironic-python-agent-builder/doc/source/admin/dib.rst

3.0 KiB

diskimage-builder images

Images built using diskimage-builder are recommended for production use on real hardware.

Building

... with the helper script

To build an image using diskimage-builder, run:

ironic-python-agent-builder <distribution, e.g. ubuntu>

You can add other diskimage-builder elements via the -e flag. For example, dhcp-all-interfaces is required for automatic DHCP on some operating systems (e.g. CentOS 7):

ironic-python-agent-builder -e dhcp-all-interfaces centos7

You can specify the base name of the target images:

ironic-python-agent-builder -o my-ipa -e dhcp-all-interfaces centos7

... with diskimage-builder

You can also use diskimage-builder directly. First you need to set the ELEMENTS_PATH variable to the correct location:

  • If installed with pip install --user, use:

    export ELEMENTS_PATH=$HOME/.local/share/ironic-python-agent-builder/dib
  • On Fedora/CentOS/RHEL (installed via sudo pip install or from packages):

    export ELEMENTS_PATH=/usr/share/ironic-python-agent-builder/dib
  • On Debian and its derivatives, if installed with sudo pip install:

    export ELEMENTS_PATH=/usr/local/share/ironic-python-agent-builder/dib

Now you can build an image adding the ironic-python-agent-ramdisk element, for example:

disk-image-create -o ironic-python-agent \
    ironic-python-agent-ramdisk centos7 dhcp-all-interfaces

To use a specific branch of ironic-python-agent, use:

export DIB_REPOREF_ironic_python_agent=origin/stable/queens

Advanced options

SSH access

SSH access can be added to DIB built IPA images with the dynamic-login or the devuser element.

The dynamic-login element allows the operator to inject an SSH key at boot time via the kernel command line parameters:

  • Add sshkey="ssh-rsa <your public key here>" to pxe_append_params setting in the ironic.conf file. Disabling SELinux is required for systems where it is enabled, it can be done with selinux=0.

    Warning

    Quotation marks around the public key are important!

  • Restart the ironic-conductor.

The devuser element allows creating a user at build time, for example:

export DIB_DEV_USER_USERNAME=username
export DIB_DEV_USER_PWDLESS_SUDO=yes
export DIB_DEV_USER_AUTHORIZED_KEYS=$HOME/.ssh/id_rsa.pub
disk-image-create debian ironic-python-agent-ramdisk devuser