Using disk-image-builder (DIB) to make bare metal image of Ironic
Making bare metal image of Ironic by Diskimage Builder
Diskimage-builder is a tool used by the openstack community to create images.
1. Installation
Yum-y install python-pipyum-y install qemu-img kpartx gitpip install-- upgrade pippip install virtualenvyum install-y libguestfs-tools-c (provide virt-sysprep) can be used to change the password later.
Installation in virtual environment
Here is a brief description of how to install dib (diskimage-builder) in a required environment
Clone the repository of the source code:
$git clone https://git.openstack.org/openstack/diskimage-builder$ git clone https://git.openstack.org/openstack/dib-utils
Create a virtual environment:
$virtualenv dib-env
Enable virtual environment
$source dib-env/bin/activate
Installation:
$cd diskimage-builder$ pip-- default-time=100 install. $cd dib-utils$ python setup.py install
Make the first mirror image
$export DIB_DEV_USER_USERNAME=centos / / initial username centos$ export DIB_DEV_USER_PASSWORD=password / / initial password password$ export DIB_DEV_USER_PWDLESS_SUDO=YES / / allows sudo$ export DIB_CLOUD_INIT_DATASOURCES= "ConfigDrive", OpenStack "/ / cloud-init datasource is ConfigDrive, OpenStack$ disk-image-create centos7 baremetal dhcp-all-interfaces grub2 install-static devuser-o password
It is strange that the password defined earlier cannot log in after installing the system.
$export LIBGUESTFS_BACKEND=direct (error will be reported if you do not perform step 2) $virt-sysprep-- root-password password:password-a centos7.qcow2 (change password to password)