Foreman: The Foreman-Plugin powered by gridscale.io

This Tutorial is about the Forman-Plugin

How to get Foreman, the lifecycle management tool for physical and virtual servers, up and running on your server is shown in our tutorial Installing and setting up Foreman under Ubuntu Linux. Also, through our tutorial Foreman – Adding and Configuring the NTP Module under Ubuntu Linux, you know how to manage time synchronization for your Foreman. This tutorial is about the Foreman plugin that provides gridscale.io for using Foreman. I will show you how to install and configure this plugin and its software components and how to use it.

About the Foreman-Plugin of gridscale

“Foreman provided by gridscale! is the motto of the plugin developed by gridscale.io for using Foreman. We provide you with the plugin to use Foreman via our own server templates and make it possible that you can interact within Foreman with our server templates via the plugin, i.e. generate them and control their activation/deactivation in Foreman. With the help of the plugin, server templates offered by gridscale.io can be created and managed directly from Foreman. This would not be possible without the plugin. For the effect of the plugin gridscale.io provides two software components, foreman-gridscale and fog-gridscale. With fog-gridscale gridscale has developed its own Ruby-Gem for fog to communicate with Foreman via the gridscale API. gridscale uses fog-gridscale as a bridge between Foreman and the gridscale API.

Install and Configure foreman-gridscale and fog-gridscale

First, update your server.

apt-get update &&apt-get upgrade

Add the content of the code snippet below to the empty file.

nano /usr/share/foreman/bundler.d/Gemfile.local.rb

Add the contents of the two code snippets presented below to the initially empty file. Make sure you include the paths to the two directories extracted from the archive.

gem 'foreman_gridscale'

In the following screenshot you can see what this should look like.

Save the update with Ctrl+O and finish your work on the contents of the file by leaving the nano editor with Ctrl+X. Then execute the following command.

cd /usr/share/foreman &&sudo -u foreman /usr/bin/foreman-ruby /usr/bin/bundle install

After that it is necessary to restart Foreman. Use the following command.

touch /usr/share/foreman/tmp/restart.txt

Getting Started with Foreman-Plugin by gridscale

In your browser, bring up Foreman’s Web UI, as I have shown you in our tutorial Installing and Configuring Foreman on Ubuntu 16.04/18.04. After you have logged in with the credentials you know, it is best to check if the plugin you just downloaded and configured from gridscale is available in Foreman. To do this, navigate to the info submenu of the Manage menu item. As shown in the two screenshots below, you should then list the plugin provided by gridscale for Foreman in the Plugins tab and see the installation confirmation in the Available Provider tab.

Foreman Web Ui in Info Menu
Foreman available Providers

Creating a New Compute Resource with the gridscale Provider

Next, go to the compute resource submenu item of the infrastructure menu item.

Click the Create compute resource button.

A tab with form fields is then generated for the new computing resource to be created, in which you then have to enter the necessary information about it. Here you have to enter a name of the new resource that appears to you to be appropriate and you can also add a description. Furthermore, you have to select a provider for your new calculation resource via the dropdown provided.

If you have followed all steps described, which are important for the correct download and configuration of foreman-gridscale and foreman-fog, and the plugin is displayed in the info submenu of the Manage menu item, then gridscale as provider should be displayed in the dropdown as a selectable option. If this is not the case, then check if the two paths previously set in the configuration file are correct. Correct the paths if necessary, and then execute the command shown below again:

cd /usr/share/foreman &&sudo -u foreman /usr/bin/foreman-ruby /usr/bin/bundle install

and restart Foreman.

touch /usr/share/foreman/tmp/restart.txt

Otherwise select gridscale as provider in the dropdown.

Two additional form fields are then generated. The gridscale user UUID and the gridscale API token with read and write access are required.

These two pieces of information can be found in your personal gridscale panel in the gridscle API section. This can be accessed either – as shown in the following screenshot – via the API-Keys menu item or via the link to the gridscale API section.

Choose API Section in gridscale Panel

You will find both information about the gridscale User-UUID and the gridscale API-Token on the respective page – as illustrated in the screenshot below and highlighted in color.

API Section in Panel

Make sure that the permission type of your token is set to “Full access” and that you have set a “Valid to” date.

If you then click the submit button, the correct creation of the resource – as shown in the screenshot below – should be confirmed. You will then be in the detail view of the new gridscale resource. You are now able to create and manage servers within your new gridscale resource.

You can access the detailed view of a computing resource at any time via the computing resource submenu item of the infrastructure menu item. As soon as at least one computing resource has been created, you will no longer see the large button for adding a computing resource on the computing resource main page – as shown in one of the previous screenshots – but a list of all currently available computing resources. However, you can still add more resources. The button is then located at the top right of the search bar. If you click on a computing resource from the list mentioned above, you will be taken to the detailed view in question.

Creating compute profiles under the gridscale-provider supported compute resource

Go back to the Compute– submenu item of the Infrastructure-menu item.

Rechenprofil Menu Foreman Web Ui

There you will see a list of all available calculation profiles. With the Create Compute Profile button you can generate as many additional calculation profiles as you like. You will only be asked for the name of the new calculation profile. The calculation profile is automatically listed under the calculation resource that was previously defined and created under the gridscale provider.

The compute profiles that already exist in the list also belong to the compute resource provided by the gridscale plug-in. You can reproduce this quite well by clicking on a computing profile. In the detail view you should see the name of the resource provided via gridscale. In my example this is the name “foreman-plugin”.

If you click on the name of the computing resource in the detail view of the respective computing profile, you will again be taken to a detail page where you can find and (re)define information on the computing profile in the context of the gridscale computing resource in form fields. Among other things, you can define the volume and the memory of the processor as well as the storage space of the storage belonging to the server.

In addition, a drop-down menu provides you with a selection of all templates supported by gridscale.

You can also use the Add Interface button to add any number of network interfaces to the computing profile, specifying the network type and IP addresses for IPv4 and IPv6.

Adapt your operating system for the use of hosts under the gridscale-provider supported computing resource

To create and maintain new hosts under the gridscale-based computing resource, you must customize your operating system in Foreman’s Web UI. To do this, navigate to the operating system submenu of the hosts menu item.

OS Menu in Foreman

There you will first find the operating system in the list under which you installed Foreman. You can also use the Create operating system button to add additional operating systems at any time. To customize the operating system, click on the operating system in the list that you prefer. In my example, I do this for the operating system already registered during the installation of Foreman.

You will then be redirected to the details page of the operating system, where different tabs allow you to fill form fields and buttons with information. In the operating system tab, you have to maintain general data about the operating system, such as the name and the main release as well as the secondary release. In the selection frames for the architectures of the operating system, you can click on the respective architecture to add it to the list of all selectable architectures. This will play a role later, when you want to generate new hosts under the gridscale-supported computing resource, because you have to provide information about the operating system and a dropdown with possible selection options is available. By customizing the operating system, you make sure that the appropriate options can be selected later in the dropdown when creating a new host.

In the partition table tab you again have two selection frames. Here you proceed in the same way as with the selection frames for the architectures shown in the screenshot above.

You can move all items to the Selected Items frame, so that when you create a host later, all of those items are provided in the drop-down list.

Finally, the installation media tab is relevant.

Also in this case, you use the two selection frames to specify the set of selectable options when generating new hosts later.

Creating hosts under the gridscale-provider-supported computing resource

You can create a new host by selecting the All hosts submenu item of the Hosts menu item and then clicking the Create host button on the page or directly clicking the Create host submenu item in the menu bar under the Hosts menu item.

Creating Hosts in Foreman Web Ui

If you go to the All hosts submenu, the list will first show you the host where you installed Foreman. It is not possible to edit this host to run as a host under the gridscale-based resource. To do this you have to create a new host via the Create Host button.

After clicking on the button in question, you will be taken to the details page, where you will find various tabs with form fields to be filled in. In the Host tab you fix general information about the new host to be created. The Foreman plugin from gridscale is now offered as an option in the Deploy toPuppet Master and Puppet CA dropdown. You then select this and in the environment dropdown the production selection applies.

In the virtual machine tab you define the frame data of your servers, which you can access via the gridscale panel. This includes data about the storage space and the type of server template (in my example Ubuntu 18.04 LTS) as well as the SSH key, which can be selected via dropdown like the server template and which you should have already specified at the beginning of the creation of your server templates by gridscale. Without an SSH key you will get an error message when trying to generate the new host.

In the operating system tab, you then maintain the information about the operating system under which the host is to be created. For the Architecture, Media, and Partition Table dropdowns, you can then choose one of the selectable options that you should have previously defined for that operating system.

Finally, the interface tab is still important. Here you can find the interface that was generated per-default for the new host to be created when you pressed the Create Host button. For this interface, however, more information needs to be added. Click on the Edit button of the interface already in the list. You can add as many interfaces as you want.

The detail interface of this interface will be opened. Make sure that the DNS name matches the name of your new host and that you have selected gridserver.io as the domain in the dropdown. All other fields and buttons in this interface are editable at your discretion. Confirm the information specified for the interface by clicking the OK button.

Now that you have implemented all relevant information for the new host in the respective tab, you can initiate the generation of the host with the submit button.

You should then receive confirmation of the successful creation of the host by being automatically redirected to the details page of the new host. This means that you now have a host in Foreman that runs on the gridscale-provided resource.

Manage hosts under the gridscale-provider supported computing resource

In Foreman it is not only possible to create hosts with the plugin developed by gridscale, but also to change their status or to delete them. There are two ways to do this. One of the two ways leads you in the navigation of the Foreman UI to the All hosts submenu of the Hosts menu item. There you will see, as already mentioned, all current hosts known to Foreman are listed in tabular form. In the second column of the table you can see the power status of each host by clicking on the respective host name you can see its detail page. You can change the power status of a host by checking the Checkmark box in the first column and selecting the Change Power state option in the Select Action drop-down at the top right. You can also run the process for a collection of hosts if you have checked all the relevant checkmark boxes.

Selecting the Change energy state option generates an interface in which you can specify in a dropdown in which form the energy state should change. Finally you confirm your change request with the submit button.

To delete a host, you can set the Delete option in the Actions column via the drop-down of the respective host. In this case you would have to perform this action for every single host you want to delete.

Alternatively, you can also use the Select action in the top right corner. This is especially useful if you want to delete several hosts at the same time. As in the case of a power state change, make sure that the Checkmark box in the first column of each host is activated.

Also in this case the selection of the respective option generates an interface in which you should confirm the deletion with the submit button.

Another way to manage your hosts created under the plugin is via the resource page, which you can find as a submenu item of the infrastructure menu item, as shown above. Here you click on the corresponding gridscale-supported resource.

You will then be redirected to the details page, where you will also see a table of all Foreman hosts in the Virtual Machines tab. Here you can – as shown on the All Hosts page – decide about the energy state of each host. Simply click the Power On/Power Off button as shown in the two following screen shots below.

If you want to delete a host from the list, just click on the drop-down next to the Power On/Power Off button and select the option you want to use to start the deletion.

Good to know …

  • When creating a host, several network interfaces can be set to bootable. The gridscale platform does not support this. Therefore in this case only one of the interfaces is actually set to bootable.
  • When creating a calculation profile, the selected network interface configuration is not saved.
  • The overview of the virtual machines of a computing resource can take a long time.
  • The data displayed on the VM tab of a host is not complete. More information about what information is useful is required.
  • Opening the console of a host in Foreman has not been implemented, but a link to gridscale is provided.
  • Shutting down the Acpi system cannot shut down a system that has not been restarted.

Conclusion

You now have the gridscale plugin for using Foreman and can create, use and manage server templates offered by gridscale within Foreman. I enjoyed helping you with the installation and configuration of the plugin and showing you how to create a new server under the gridscale-supported resource, delete it or change its power state. I wish you a lot of fun using our plugin! 🙂