Go back

How to get Puppet with Foreman GUI- an alternative to Puppet Enterprise & Puppet Razor on GCP(Google Cloud Platform)

This section describes how to launch and connect to Puppet Foreman in a Google Compute environment using the available Cloud Launcher offering.

Note: The Foreman VM will be able to manage Puppet hosts within the same GCP project as the VM. So make sure that you deploy the VM in the desired project and on default network

  1. Open **Puppet with Foreman GUI- an alternative to Puppet Enterprise & Puppet Razor ** listing on GCP Marketplace
  2. Click Launch.

/img/gcp/puppet-support/marketplace.png

  • It will take you to the agreement page. On this page, you can change the project from the project selector on top navigator bar as shown in the below screenshot.

  • Accept the Terms and agreements by ticking the checkbox and clicking on the AGREE button. /img/common/gcp_agreement_page.png

  • It will show you the successfully agreed popup page. Click on Deploy. /img/common/gcp_agreement_accept_page.png

  • Select a zone where you want to launch the VM(such as us-east1-)

  • Optionally change the number of cores and amount of memory. ( This defaults to 1 vCPUs and 3.75 GB ram)

  • Optionally change the boot disk type and size. (This defaults to ‘Standard Persistent Disk’ and 10 GB respectively)

  • Optionally change the network name and subnetwork names. Be sure that whichever network you specify has ports 22 (for ssh), 3389 (for RDP), 80 (for HTTP) and 443 (for HTTPS) (Please Select the default network here as shown below) exposed.

  • Click Deploy when you are done.

  • Puppet with Foreman GUI- an alternative to Puppet Enterprise & Puppet Razor will begin deploying.

/img/gcp/puppet-support/deployed.png

  1. A summary page displays when the compute engine is successfully deployed. Click on the Instance link to go to the instance page .

  2. On the instance page, click on the “SSH” button, select “Open in browser window”.

/img/gcp/puppet-support/ssh-option.png

  1. This will open SSH window in a browser.
  2. Run below command to set the password for “ubuntu” user
sudo passwd ubuntu

/img/gcp/jupyter-python-notebook/ssh-passwd.png

  1. Now the password for ubuntu user is set, you can connect to the VM’s desktop environment from any local windows machine using RDP or linux machine using Remmina.

  2. To connect using RDP via Windows machine, first note the external IP of the VM from VM details page as highlighted below

/img/gcp/jupyter-python-notebook/external-ip.png

  1. Then From your local windows machine, goto “start” menu, in the search box type and select “Remote desktop connection”

  2. In the “Remote Desktop connection” wizard, paste the external ip and click connect

/img/gcp/jupyter-python-notebook/rdp.png

  1. This will connect you to the VM’s desktop environment. Provide “ubuntu” as the userid and the password set in step 6 to authenticate. Click OK

/img/gcp/puppet-support/rdp-login.png

  1. Now you are connected to out of box Puppet with Foreman GUI- an alternative to Puppet Enterprise & Puppet Razor environment via Windows machines.

/img/gcp/puppet-support/rdp-desktop.png

  1. To connect using RDP via Linux machine, first note the external IP of the VM from VM details page,then from your local Linux machine, goto menu, in the search box type and select “Remmina”.

Note: If you don’t have Remmina installed on your Linux machine, firstInstall Remmina as per your linux distribution.

/img/gcp/common/remmina-search.png 14. In the “Remmina Remote Desktop Client” wizard, select the RDP option from dropdown and paste the external ip and click enter.

/img/gcp/common/remmina-external-ip.png 15. This will connect you to the VM’s desktop environment. Provide “ubuntu” as the userid and the password set in step 6 to authenticate. Click OK

/img/gcp/common/remmina-rdp-login.png 16. Now you are connected to out of box Puppet with Foreman GUI- an alternative to Puppet Enterprise & Puppet Razor environment via Linux machine.

/img/gcp/puppet-support/rdp-desktop.png

  1. After VM creation, the Puppet & Foreman setup takes 20-30 minutes to complete. To check if the setup is finished, run below command which will show the setup logs. Once the setup is finished, you should see " ### foreman setup completed ### “ at the end of the log.
tail -f /var/log/cloud-init-output.log

/img/gcp/puppet-support/foreman-setup-completed.png

Once the setup completes, VM will restart automatically.

  1. Once the VM restars automatically after Foreman setup completion, The Foreman console should be up and running. The console can be accessible via https://vm-public-ip . If you don’t want to expose the console on public ip, you can login to the GUI desktop environment as explained above and open the console via https://vm-internal-ip in the firefox browser.
  2. The login id for console is admin . A random password is generated during setup which can be found by running below command :
**grep foreman::params::initial_admin_password: /var/log/foreman-installer/foreman***

/img/gcp/puppet-support/default-passwd-ssh.png

/img/gcp/puppet-support/certificate-warning-02.png

/img/gcp/puppet-support/foreman-admin-login.png

/img/gcp/puppet-support/puppet-foreman-console.png

  1. Once you login, it is highly recommended to change the admin password by going to user profile and resetting the password.
  • To change the password, click on Admin user on top-right and select My account option. /img/gcp/puppet-support/my-account-option.png
  • In User tab, enter the current password and then enter new password and submit it. /img/gcp/puppet-support/update-password.png
  1. If you have exposed the VM on public IP, it is highly recommended to make the IP static in order to keep the same IP over server restarts . Please follow this link to know the steps for making the IP static
  2. Foreman console allows you to manage your infrastructure by creating hosts and configuring them as per your requirements. In order to allow host creation and management, Foreman uses following components & concepts :
  • Smart Proxy : To orchestrate the process of commissioning a new host and providing API interface . A smart proxy is already created out of box during installation and should be sufficient for your use.
  • Compute Resources : Foreman supports creating and managing hosts on a number of virtualization and cloud services including GCP via “Compute Resources” . You will need to create at least one GCP compute resource per region to manage hosts within that region. Steps for creating GCP compute resource are detailed later in the guide.
  • Compute Profile : A compute profile is linked to a computer resource to help you default certain properties of the compute resources like defaulting the VM size to “f1-micro” . Steps for creating GCP compute profile are detailed later in the guide.
  1. Creating GCP Compute Resource :
  • In GCP console, select the project where Foreman VM is deployed.

/img/gcp/puppet-support/select-project.png

  • In GCP console, search for “API & Services” and goto the “API & Services” console, click on “Credentials” from left menu.

/img/gcp/puppet-support/api.png

  • In the credentials console, click on the default service account, scroll down to the “Key” section click on “Add Key” and select “create new key” and choose “JSON” format and click create.

/img/gcp/puppet-support/create-new-key.png

/img/gcp/puppet-support/json-format.png

Save the key locally with the name “gce.json”.

/img/gcp/puppet-support/download-json.png

On the same service account page, copy the service account email. Also copy the project ID and keep email and project id handy

/img/gcp/puppet-support/email-account.png

To copy the Project ID, click on Project Name at the top of the gcp console. It will open projects list. Infront of Project Name, Project ID is given. Copy this ID.

/img/gcp/puppet-support/project-id.png

  • Next, upload the saved key to foreman server at /usr/share/foreman/gce.json

To upload the gce.json file, SSH to puppet-foreman VM as shown in step 4. Click on gear button and select upload file option. Browse your gce.json file and upload it.

/img/gcp/puppet-support/upload-option.png

By default it gets uploaded in the home directory. run below command to move it to /usr/share/foreman/gce.json location. once it is moved to the specified location check it using ls command shown below.

mv gce.json /usr/share/foreman/
ls /usr/share/foreman

/img/gcp/puppet-support/move-gce-file.png

  • Once the key is uploaded to server, it is recommended to delete the local copy for security reasons.
  • Now go back to Foreman web console, click on “Infrastructure → Compute Resources” and click on “Create Compute Resources” button.

/img/gcp/puppet-support/infrastructure.png

/img/gcp/puppet-support/compute-resources.png

  • In the displayed page, select “Google” from provider drop down. If you don’t see “Google” in the provider dropdown, restart the VM and try again.
  • Give it suitable Name. e.g. GCP Compute Resource
  • Provide the project id copied earlier in Google Project ID and service account email in Client Email fields.
  • Set the Certificate Path field to /usr/share/foreman/gce.json
  • For Zone, click on Load Zones button and select the zone where you want Foreman to create and manage hosts. Click on Test Connection button to make sure Foreman can connect to the zone.
  • Click on Submit . New GCP Compute Resource should get created now. /img/gcp/puppet-support/compute-resource-page.png
  1. Creating GCP Compute Profiles (Optional)
  • Creating compute profile is optional . Profile allows you to set default values to various GCP attributes like VM size, network, storage disks etc.

You can create compute profile by following Infrastructure → compute profile → create option

/img/gcp/puppet-support/compute-profile.png

  • Give Name to the compute profile and submit it.

/img/gcp/puppet-support/create-compute-profile.png

  • Now select the compute resource you want to edit. You can edit compute resource default VM attributes.e.g changing machine type, assigning Ephemeral External IP etc. /img/gcp/puppet-support/edit-compute-profile.png
  • Now that GCP Compute Resource and profile (optionally) are created, you can manage Puppet hosts with Foreman. Refer to Creating and Managing Puppet Hosts from Foreman for more details
Go back