Introduction
Last updated
Last updated
The Ionoscloud Puppet module allows a multi-server cloud environment using Ionoscloud resources to be deployed automatically from a Puppet manifest file.
This module utilizes the IONOS Cloud Cloud API via the Ionoscloud Ruby SDK to manage resources within a virtual data center. A Puppet manifest file can be used to describe the desired infrastructure configuration including networks, servers, CPU cores, memory, and their relationships as well as states. That infrastructure can then be easily and automatically deployed using Puppet.
Before you begin you will need to have signed-up for a Ionoscloud account. The credentials you establish during sign-up will be used to authenticate against the Ionoscloud Cloud API.
Puppet 4.2.x or greater
Ruby 2.0 or greater
Ionoscloud Ruby SDK (ionoscloud)
Ionoscloud account
There are multiple ways that Puppet and Ruby can be installed on an operating system (OS).
For users who already have a system with Puppet and Ruby installed, the following three easy steps should get the Ionoscloud Puppet module working. Note: You may need to prefix sudo
to the commands in steps one and two.
Install the Ionoscloud Ruby SDK using gem
.
Install the module.
Set the environment variables for authentication.
or
Note: Be aware that setting the token makes the username and password be ignored, in order to use the username and password one must unset the token value.
A situation could arise in which you have installed a Puppet release that contains a bundled copy of Ruby, but you already had Ruby installed. In that case, you will want to be sure to specify the gem
binary that comes with the bundled version of Ruby. This avoids a situation in which you inadvertently install the ionoscloud library but it is not available to the Ruby install that Puppet is actually using.
To demonstrate this on a CentOS 7 server, these steps could be followed.
Note: You may need to prefix sudo
to the commands in steps one through three.
Install Puppet using the official Puppet Collection.
Install the Ionoscloud Ruby SDK using gem
. Note: We are supplying the full path to the gem
binary.
Install the Puppet module. Note: We are supplying the full path to the puppet
binary.
Set the environment variables for authentication.
or
A Puppet manifest uses a domain specific language, or DSL. This language allows resources and their states to be declared. Puppet will then build the resources and set the states as described in the manifest. The following snippet describes a simple LAN resource.
A LAN named public
will have public Internet access enabled and will reside in the defined virtual data center.
Note: It is important that resource names be unique within the manifest. This includes both similar and different resource types. For example, a LAN resource named public
will conflict with a server resource named public
.
To provide a data center ID, you can create a data center within the module as follows:
Afterwards, get the data center ID using the puppet resource command:
which should return output similar to this:
The returned id value of 4af72f13-221d-499d-88ea-48713173e12f may be used elsewhere in our manifest to identify this virtual data center.
A data center name can be used instead. You may find this more convenient than using a data center ID. Please refer to the next section for an example.
If you have already created your data center, LAN and server resources, you may connect them with a new NIC resource using their names or IDs.
Note: Using the Ionoscloud Puppet module to manage your Ionoscloud resources ensures uniqueness of the managed instances. The Ionoscloud Cloud API allows the creation of multiple virtual data centers having the same name.
If you attempt to manage LAN and server resources using data center names, the module will throw an error when more than one virtual data center with the same name is detected. The same is true if you attempt to remove virtual data centers by non-unique names.
Once you have composed a manifest, it is good to have Puppet validate the syntax. The Puppet accessory parser
can check for syntax errors. To validate a manifest named init.pp
run:
If the manifest validates successfully, no output is returned. If there is an issue, you should get some output indicating what is invalid:
That error message indicates we should take a look at a curly brace located on line 8 column 2 of init.pp
.
To have puppet go ahead and apply the manifest run:
Bugs & feature requests can be open on the repository issues: https://github.com/ionos-cloud/puppet-module/issues/new/choose