Skip to content

Latest commit

 

History

History
58 lines (55 loc) · 2.5 KB

proc_adding-a-google-gce-connection.adoc

File metadata and controls

58 lines (55 loc) · 2.5 KB

Adding a Google GCE Connection to {ProjectServer}

Use this procedure to add Google Compute Engine (GCE) as a compute resource in {Project}. To use the CLI instead of the {ProjectWebUI}, see the CLI procedure.

Procedure
  1. In Google GCE, generate a service account key in JSON format. For more information, see Create and manage service account keys in the GCE documentation.

  2. In the {ProjectWebUI}, navigate to Infrastructure > Compute Resources and click Create Compute Resource.

  3. In the Name field, enter a name for the compute resource.

  4. From the Provider list, select Google.

  5. Optional: In the Description field, enter a description for the resource.

  6. In the JSON key field, click Choose File and locate your service account key for upload from your local machine.

  7. Click Load Zones to populate the list of zones from your GCE environment.

  8. From the Zone list, select the GCE zone to use.

  9. Click Submit.

CLI procedure
  1. In Google GCE, generate a service account key in JSON format. For more information, see Create and manage service account keys in the GCE documentation.

  2. Copy the file from your local machine to {ProjectServer}:

    # scp My_GCE_Key.json root@{foreman-example-com}:/etc/foreman/My_GCE_Key.json
  3. On {ProjectServer}, change the owner for your service account key to the foreman user:

    # chown root:foreman /etc/foreman/My_GCE_Key.json
  4. On {ProjectServer}, configure permissions for your service account key to ensure that the file is readable:

    # chmod 0640 /etc/foreman/My_GCE_Key.json
  5. On {ProjectServer}, restore SELinux context for your service account key:

    # restorecon -vv /etc/foreman/My_GCE_Key.json
  6. Use the hammer compute-resource create command to add a GCE compute resource to {Project}:

    # hammer compute-resource create \
    --key-path "/etc/foreman/My_GCE_Key.json" \
    --name "My_GCE_Compute_Resource" \
    --provider "gce" \
    --zone "My_Zone"