Before you can use SoftLayer® images
with the blueprint designer, you must install cloud-init on those
images.
Cloud-init is a set of scripts and utilities that cloud systems use to
initialize and configure instances.
Procedure
- On the Linux image, install the cloud-init package,
version 0.7.5 or version 0.7.6. If you use a image, This package is available from the Red Hat Network (RHN) common channel.
On Linux images, you can often install cloud-init with the
package manager. For example, if you are using a Red Hat Enterprise Linux (RHEL) version 7 image, you can enable the common repository and
install cloud-init with the following
command:
yum install --enablerepo rhel-7-server-rh-common-rpms cloud-init
You
might need to adapt this command for your distribution of Linux. For example, for RHEL version 6, substitute the repository
rhel-6-server-rh-common-rpms in this command. If you have a problem enabling the
common repository, you might need to subscribe to the common channel with a command that is similar
to the following
example:subscription-manager repos --enable=rhel-7-server-rh-common-rpms
Then,
try running the install command again.
The
following instructions assume that cloud-init was installed by the yum package
manager. You might need to adapt these instructions to work with other package managers or other
distributions of Linux.
- On the image, provide the Heat types that are necessary for cloud-init. Copy the file DataSourceSL.py to the folder
/usr/lib/python2.6/site-packages/cloudinit/sources/. This file is provided with
the installation files for the heat engine and is available at the following location:
ibm-ucd-patterns-install/engine-install/resources/cloud-init/softlayer/linux
- Update the configuration file for cloud-init:
- Open the file /etc/cloud/cloud.cfg in a text editor.
- Remove any lines of code that begin with datasource_list.
- Add the following line of code:
datasource_list: ['SL']
- To enable password access through SSH for the root user, set the value of
disable_root to 0. If the disable_root configuration value is not present, then add the
following line of code to the file:
disable_root: 0
- Save your changes to the file.
- Optional: If you want to run Chef roles on the image, run the automated script to install the
heat-config toolchain on the image.
Note: Chef roles are supported only on RHEL version 7 images.
- Download and extract the file os-chef-config-hook.tgz. This file is provided in the heat engine installation media and is in the following location:
/installation_files_location/ibm-ucd-patterns-install/engine-install/resources
- Copy the file install.sh to a temporary folder, such as
/tmp/install_chain.
- On the command line, move to the temporary folder.
- Run the following command:
./install.sh > install.log 2>&1
This command might take
several minutes to complete.
- Verify that the command ran successfully by looking at the end of the file
install.log. The end of this file should show the output of the
os-collect-config command, as in the following
example:
+ cat /etc/os-collect-config.conf
[DEFAULT]
command = os-refresh-config
+ os-collect-config --one-time --debug
2015-08-14 13:51:30.764 27527 WARNING os_collect_config.ec2 [-] ('Connection aborted.', error(101, 'Network is unreachable'))
2015-08-14 13:51:30.765 27527 WARNING os-collect-config [-] Source [ec2] Unavailable.
2015-08-14 13:51:30.765 27527 WARNING os_collect_config.cfn [-] No Access Key ID configured.
2015-08-14 13:51:30.766 27527 DEBUG os-collect-config [-] Source [cfn] Not configured. collect_all /usr/lib/python2.6/site-packages/os_collect_config/collect.py:153
2015-08-14 13:51:30.766 27527 WARNING os_collect_config.heat [-] No auth_url configured.
2015-08-14 13:51:30.766 27527 DEBUG os-collect-config [-] Source [heat] Not configured. collect_all /usr/lib/python2.6/site-packages/os_collect_config/collect.py:153
2015-08-14 13:51:30.767 27527 WARNING os_collect_config.request [-] No metadata_url configured.
2015-08-14 13:51:30.767 27527 WARNING os-collect-config [-] Source [request] Unavailable.
2015-08-14 13:51:30.767 27527 WARNING os_collect_config.local [-] /var/lib/os-collect-config/local-data not found. Skipping
2015-08-14 13:51:30.767 27527 WARNING os_collect_config.local [-] No local metadata found (['/var/lib/os-collect-config/local-data'])
2015-08-14 13:51:30.768 27527 DEBUG os-collect-config [-] No changes detected. __main__ /usr/lib/python2.6/site-packages/os_collect_config/collect.py:274
- Optional: Verify that the Chef client and the knife command line tool are running.
- To confirm that the Chef client is running, on the command line, run the following command:
chef-client -v
The version number is displayed. If the Chef client is not
running, manually install it. See Chef Downloads: Chef Client.
- To confirm that the knife command line tool is running, on the command line, run the following
command:
knife -v
The version number is displayed. If the knife command line
tool is not running, manually configure the Chef development kit. See Install the Chef
DK.
- Capture the image as a template for the cloud system:
- Shut down the image with the following command:
shutdown -h now
- From the SoftLayer Customer Portal, find your instance by clicking .
- Click the instance to select it.
- From the Actions list, click Power
On/Off. The system warns you that the image is already powered off. This step is
necessary to ensure that SoftLayer knows that the image is powered off.
- From the Actions list, click Create Image
Template and follow the steps to create a template from your
image.
For more information about creating images from the SoftLayer Customer Portal, see Create a Standard Image.
What to do next
You can use the image in blueprints that you create on the blueprint designer. See
Modeling environments for SoftLayer.