Introduction

Overview

Chef is a popular configuration management tool that allows simplified configuration and maintenance of both servers and cloud provider environments through the use of common templates called recipes. The Chef knife command line tool allows management of various nodes within those environments. The knife-ionoscloud plugin utilizes the IONOS Cloud REST API to provision and manage various cloud resources on the IONOS Cloud platform.

Getting Started

An IONOS account is required for access to the Cloud API; credentials from your registration are used to authenticate against the IONOS Cloud API.

Installation

The knife-ionoscloud plugin can be installed as a gem:
1
$ gem install knife-ionoscloud
Copied!
Or the plugin can be installed by adding the following line to your application's Gemfile:
1
gem 'knife-ionoscloud'
Copied!
And then execute:
1
$ bundle
Copied!

Configuration

The Ionoscloud account credentials can be added to the knife.rb configuration file.
1
knife[:ionoscloud_username] = 'username'
2
knife[:ionoscloud_password] = 'password'
Copied!
If a virtual data center has already been created under the Ionoscloud account, then the data center UUID can be added to the knife.rb which reduces the need to include the --datacenter-id [datacenter_id] parameter for each action within the data center.
1
knife[:datacenter_id] = 'f3f3b6fe-017d-43a3-b42a-a759144b2e99'
2
3
knife[:ionoscloud_debug] = true
Copied!
The configuration parameters can also be passed using shell environment variables. First, the following should be added to the knife.rb configuration file:
1
knife[:ionoscloud_username] = ENV['IONOSCLOUD_USERNAME']
2
knife[:ionoscloud_password] = ENV['IONOSCLOUD_PASSWORD']
Copied!
Now the parameters can be set as environment variables:
1
$ export IONOSCLOUD_USERNAME='username'
2
$ export IONOSCLOUD_PASSWORD='password'
Copied!

Testing

1
$ rspec spec
Copied!

Getting input from a file

In order to make passing JSON or array arguments easier, we allow you to specify a file which holds the arguments for a command. This is done with the --extra-config EXTRA_CONFIG_FILE_PATH or -e EXTRA_CONFIG_FILE_PATH. The file is expected to contain a JSON which should map the name of arguments to their expected values. Here is an example of such a file.
1
{
2
"ionoscloud_username": "username",
3
"ionoscloud_password": "password",
4
"name": "test_datacenter_name",
5
"location": "de/txl"
6
}
Copied!
When using the command knife ionoscloud datacenter create --extra-config EXTRA_CONFIG_FILE_PATH where EXTRA_CONFIG_FILE_PATH is the name of the file containing the JSON above, the arguments described in the file will be used.
    If any of the arguments are set in any other way, the values from the file will be ignored. Running the command knife ionoscloud datacenter create --location us/las --extra-config EXTRA_CONFIG_FILE_PATH will create a datacenter in the 'us/las' location. In the same way if the values for ionoscloud_username and ionoscloud_password are already set in the knife.rb file, the contents from the JSON will be ignored.
    Only Ionoscloud specific options may be altered using this option.
    If an option is ignored because it is not on the available options list or if it is overwritten in another way then a warning message will be displayed.

Feature Reference

The IONOS Cloud plugin for Knife aims to offer access to all resources in the IONOS Cloud API and also offers some additional features that make the integration easier:
    authentication for API calls
    handling of asynchronous requests

FAQ

    1.
    How can I open a bug/feature request?
Bugs & feature requests can be open on the repository issues: https://github.com/ionos-cloud/knife-ionos-cloud/issues/new/choose
Last modified 2mo ago