Chapter 13. Provisioning Cloud Instances in Google Compute Engine
Red Hat Satellite 6 can interact with Google Compute Engine (GCE), including creating new virtual machines and controlling their power management states. Only image-based provisioning is supported for creating GCE hosts.
13.1. Prerequisites for GCE Provisioning
Before you begin, ensure that the following conditions are met:
- In your GCE project, configure a service account with the necessary IAM Compute role. For more information, see Compute Engine IAM roles in the GCE documentation.
-
In your GCE project-wise metadata, set the
enable-oslogin
toFALSE
. For more information, see Enabling or disabling OS Login in the GCE documentation. -
Optional: If you want to use Puppet with GCE hosts, navigate to Administer > Settings > Puppet and enable the
Use UUID for certificates
setting to configure Puppet to use consistent Puppet certificate IDs. -
Based on your needs, associate a
finish
oruser_data
provisioning template with the operating system you want to use. For more information about provisioning templates, see Section 3.7.1, “Types of Provisioning Templates”. - Synchronize content repositories for the version of Red Hat Enterprise Linux that you want to use. For more information, see Synchronizing Red Hat Repositories in the Content Management Guide.
- Create an activation key for host registration. For more information, see Creating An Activation Key in the Content Management guide.
13.2. Adding a GCE Connection to Satellite Server
Use this procedure to add a GCE connection to Satellite Server to be able to add images and provision hosts on GCE.
Procedure
To add a connection, complete the following steps:
-
In GCE, generate a service account key in JSON format and upload this file to the
/usr/share/foreman/
directory on Satellite Server. On Satellite Server, configure permissions for the service account key to ensure that the file is readable by the
foreman
user:# chown foreman /usr/share/foreman/gce_key.json # chmod 0600 /usr/share/foreman/gce_key.json # restorecon -vv /usr/share/foreman/gce_key.json
- In the Satellite web UI, navigate to Infrastructure > Compute Resources and click Create Compute Resource.
- In the Name field, enter a name for the resource.
- From the Provider list, select Google.
- Optional: In the Description field, enter a description for the resource.
- In the Google Project ID field, enter the project ID.
- In the Client Email field, enter the client email.
-
In the Certificate Path field, enter the path to the service account key. For example,
/usr/share/foreman/gce_key.json
. - Click Load Zones to populate the list of zones from your GCE environment.
- From the Zone list, select the GCE zone to use.
- Click Submit.
13.3. Adding GCE Images to Satellite Server
GCE uses image-based provisioning to create hosts. You must add image details to your Satellite Server.
Procedure
To add an image, complete the following steps:
- In the Satellite web UI, navigate to Infrastructure > Compute Resources and click the GCE connection.
- Click the Images tab.
- Click Create Image.
- In the Name field, enter a name for the image.
- From the Operating system list, select the base operating system for the image.
- From the Architecture list, select the operating system architecture.
-
In the User field, enter the SSH user name for image access. Specify a user other than
root
, because theroot
user cannot connect to a GCE instance using SSH keys. The username must begin with a letter and consist of lowercase letters and numbers. - From the Image list, select the GCE image.
-
Optional: If the selected image supports
cloud-init
, select the User data check box to enable user data input. - Click Submit to save the image details.
13.4. Adding GCE Details to a Compute Profile
You can add GCE details to a compute profile to automatically populate virtual machine-based settings on host creation.
Procedure
To add details to a compute profile, complete the following steps:
- In the Satellite web UI, navigate to Infrastructure > Compute Profiles and click the name of your profile.
- Select a GCE connection.
- From the Machine Type list, select the machine type to use for provisioning.
- From the Image list, select the image to use for provisioning.
- From the Network list, select the GCE network to use for provisioning.
- Optional: Select the Associate Ephemeral External IP check box to assign a dynamic ephemeral IP address that Satellite uses to communicate with the host. This public IP address changes when you reboot the host. If you need a permanent IP address, reserve a static public IP address on GCE and attach it to the host.
- In the Size (GB) field, enter the size of the storage to create on the host.
- Click Submit to save the compute profile.
13.5. Creating Image-Based Hosts on GCE
The GCE provisioning process creates hosts from existing images on GCE.
Procedure
To create a host on GCE, complete the following steps:
- In the Satellite web UI, navigate to Hosts > Create host.
- In the Name field, enter a name for the host.
- Click the Organization and Location tabs to ensure that the provisioning context is automatically set to the current context.
- Optional: From the Host Group list, you can select a host group to populate most of the new host’s fields.
- From the Deploy on list, select the GCE connection.
- From the Compute Profile list, select a profile to use to automatically populate virtual machine-based settings.
- Click the Interface tab and click Edit on the host’s interface.
Verify that the fields are automatically populated with values, particularly the following items:
- The Name from the Host tab becomes the DNS name.
- The MAC address field is blank.
- The Domain field is populated with the required domain.
- The Managed, Primary, and Provision options are automatically selected for the first interface on the host. If not, select them.
- Click the Operating System tab, and select the operating system to install.
-
Click Resolve in Provisioning templates to verify that the new host can identify the correct provisioning templates to use. You must select either a
finish
oruser_data
provisioning template. - Click the Parameters tab and ensure that a parameter exists that provides an activation key. If not, add an activation key.
- Click Submit to save the host entry.