Bookmark this page

Manage Content Hosts on Google Compute Platform

Objectives

  • Manage content host cloud instances on Google Compute Platform by using Red Hat Satellite.

Provision Cloud Instances in Google Compute Engine

Note

This section is optional.

You can go through the section if you are interested in provisioning cloud instances in Google Compute Engine.

Google Compute Engine (GCE) is a web service that provides a public cloud platform. Satellite interacts with GCE to create virtual machines and to control their power management states. GCE supports only image-based provisioning for creating hosts.

To prepare your on-premise Satellite Server to manage GCE instances, synchronize the appropriate content repositories for Red Hat Enterprise Linux and custom products. Create activation keys for host registrations by configuring each key with subscriptions, a lifecycle environment, content view, repositories, and host collection membership to support the content host's applications. In your GCE project, configure a service account with the necessary Identity and Access Management (IAM) Compute role, and set the enable-oslogin parameter to false. Then, associate a finish or user-data provisioning template with the operating system to use.

Create a Connection for the GCE Compute Resource

To create a GCE connection, first generate a service account key in JSON format in GCE. Then, copy the key to the /usr/share/foreman directory on Satellite Server.

Change the key owner to the foreman user, set the appropriate permissions, and restore the SELinux context.

[root@satellite ~]# chown foreman /usr/share/foreman/keyname.json
[root@satellite ~]# chmod 600 /usr/share/foreman/keyname.json
[root@satellite ~]# restorecon /usr/share/foreman/keyname.json

In the Satellite web UI, navigate to InfrastructureCompute Resources, click Create Compute Resource, and enter a name for the compute resource. From the Provider list, select Google. Use the Description field to enter information to recognize the resource later.

Enter the GCE project ID in the Google Project ID field. Complete the Client Email field. In the Certificate Path field, select the previously generated service account key. Click Load Zones to populate the list, and select the GCE zone to use for this connection. Finally, click Submit.

You can also use the hammer command for the same task.

[root@satellite ~]# hammer compute-resource create --name "gce_resource" \
--provider "gce" --project "gce_project_id" \
--key-path "key.json" --zone "us-east-1" \
--email "gce@email.com"

Add GCE Images to Satellite Server

GCE uses image-based provisioning to create hosts. Load your Cloud Access-enabled images to GCE. Alternatively, Red Hat provides Gold Google Machine Images for Red Hat Cloud Access clients to use.

Google gold images are not preconfigured to use the Red Hat Update Infrastructure (RHUI). To maintain the cloud instances that are deployed from the gold images, use the Red Hat Subscription Management or Red Hat Satellite.

To add image details for your uploaded or existing Google images to the Satellite Server, including access details and image location, navigate to InfrastructureCompute Resources and select a GCE connection. Then, click Create Image.

Supply a name to identify the image for future use. Select the operating system and architecture that corresponds with the image. Enter the username and password for an account that is already configured on that image that allows access for post-configuration and ongoing management. Specify a user other than the root user, because the root user cannot connect to a GCE instance by using SSH keys. Select an image from the GCE compute resource in the Image list.

If your image supports user data input, then select the User Data checkbox. For user-data input, you must build the image with the cloud-init tool or similar configuration tooling. Click Submit to save the image details.

You can use the hammer command for the same task:

[root@satellite ~]# hammer compute-resource image create --name "gce_image" \
--operatingsystem "RHEL 7.7" --architecture "x86_64" --username admin \
--user-data true --uuid "my_uuid" --compute-resource "gce_resource"

Add GCE Details to a Compute Profile

You can add GCE hardware settings to a compute profile, so that when you create a host by using the compute profile, the settings are automatically populated.

To add hardware settings to a compute profile, navigate to InfrastructureCompute Profiles and select a GCE compute profile. Select the values for the Machine Type, Images, and Network lists. Finally, enter the storage size to create on the host in the Size (GB) field. Click Submit to save the image details.

You can use the hammer command for the same task. Enter the --compute-attributes option as a long, single line.

[root@satellite ~]# hammer compute-resource values create \
--compute-profile "gce_profile" --compute-resource "gce_resource"\
--volume "size_gb=30" --architecture "x86_64" --username root \
--compute-attributes="machine_type=f1-micro,associate_external_ip=true,
network=default"

Deploy a Host on GCE

The GCE provisioning process creates hosts from existing images on the GCE server.

To deploy a new host, navigate to HostsCreate Host. After entering a name for the new host, select a host group from the Host Group list to populate most of the new host's fields. Select a GCE connection and compute profile to automatically populate the virtual-machine-based settings.

On the Interface tab, verify that the host's interface information is already populated with values. Satellite Server automatically selects an IP address and set the Managed, Primary, and Provision options for the first interface on the host. Leave the MAC address field blank, for the cloud provider to autogenerate it.

Verify that the fields on the Operating System and Virtual Machine tabs are populated with values. On the Parameters tab, ensure that a parameter exists that provides an activation key. If the parameter does not exist, then add an activation key. Click Submit to save your host entry, which immediately triggers the GCE service to create the instance, by using the specified image as the new host's boot volume.

You can also use the hammer command for the same task. Enter the --compute-attributes option as a long, single line.

[root@satellite ~]# hammer host create --name "gce-test1" \
--organization "Finance" --location "Boston" --hostgroup "Base" \
--compute-resource "gce_resource" --provision-method image \
--image "gec_image" --root-password root_password \
--interface "managed=true,primary=true,provision=true,domain_id=1" \
--puppet-environment-id 1 --puppet-ca-proxy-id 1 --puppet-proxy-id 1 \
--architecture x86_64 --operatingsystem "RHEL 7.7"

References

For more information about Red Hat in the public cloud, see https://access.redhat.com/public-cloud

For more information, see the Provisioning Cloud Instances on Google Compute Engine section in the Provisioning Guide at https://access.redhat.com/documentation/en-us/red_hat_satellite/6.11/html-single/provisioning_hosts/index#Provisioning_Cloud_Instances_on_Google_Compute_Engine_provisioning

Revision: rh403-6.11-3ad886e