Kitchen::Softlayer

April 25, 2017 ยท View on GitHub

Gem Version Gem Downloads Build Status

Kitchen::Softlayer

A Test Kitchen Driver for Softlayer

Installation

Add this line to your application's Gemfile:

gem 'kitchen-softlayer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kitchen-softlayer

Usage

By default set the following environment variables to your softlayer credentials:

      softlayer_username
      softlayer_api_key
      softlayer_default_datacenter    (optional)
      softlayer_default_domain        (optional)

So you don't need to code these in the .kitchen.yml file which is much better from a security point of view as the kitchen.yml file can be checked in to source control without containing key data.

An example of the driver options in your .kitchen.yml file:

    driver:
      name: softlayer
        key_name: 'myuploadedsshkeylabel'
        ssh_key: C:/mykeys/my_private_sshkey.pem
        username: root
        server_name: 'myserver-test'
        domain: softlayer.com        
        flavor_id: m1.tiny
     #  image_id: '3b235124-a190-40b5-9720-c020e61b99e1'
        os_code: 'CENTOS_7_64'
        private_network_only: true
        cpu: 1,
        ram: 1024,
        datacenter: lon02

os_code and image_id

you need to either specify softlayer's operating System Reference Code via parameter os_code or an image_id.

private_network_only

By default this parameter is set to false so no public network with be created. For test-kitchen to access the server via ssh it needs to be on the softlayer private VPN. See:

Using SSL VPN

ssh_key

Currently the driver only supports using SSH keys to access servers. This requires that you upload an SSH Key in Softlayer see:

SSH Keys

in the kitchen.yml file specify the label of the ssh key as the parameter key_name and specify the private key for the uploaded public key as parameter ssh_key.

The image_ref and flavor_ref options can be specified as an exact id, an exact name, or as a regular expression matching the name of the image or flavor.

server_name

the driver checks for a server with the server_name and will use that server instead of creating another one.

disable_ssl_validation

the driver uses the fog-softlayer ruby client to communicate with softlayer. If you get SSL certificate validation errors then the workaround is to set disable SSL cert validation to true however it is better to set the environment variable 'SSL_CERT_FILE' to a valid certificate file.

Softlayer Driver Options

keydefault valueNotes
softlayer_usernameENV['softlayer_username']
softlayer_api_keyENV['softlayer_api_key']
softlayer_default_datacenterENV['softlayer_default_datacenter']
softlayer_default_domainENV['softlayer_default_domain']
server_namenilServer Name
server_name_prefixnilIf you want to have a static prefix for a random server name.
key_namenilthe label of the uploaded key
ssh_keynilfile location of private key
disable_ssl_validationfalsessl validation for fog softlayer api
username'root'server's administration user
passwordnilserver's administration password
port'22'ssh port of servef
domainENV['softlayer_default_domain']domain nane of server
fqdnnilfully qualified domain name
cpunilno of cpus
ramnilmemory size
disknildisk size
flavor_idniltype of server i.e. m1.tiny
bare_metalfalseserver to be created on bare metal (takes longer)
os_codenilsoftlayer's operating System Reference Code
image_idnilimage name or internal id
ephemeral_storagenilstorage
network_componentsnilnetwork
ssh_timeout300timeout to ssh when server starting
ssh_via_hostnamefalseuse server_name for ssh instead of IP
alternate_ipnilalternate ip address for ssh access
destroy_waittruewait for destroy to complete
destroy_timeout300timeout to wait until server destroyed
account_idnilsoftlayer account id
datacenterENV['softlayer_default_datacenter']datacenter code
single_tenantfalsedon't share server
global_identifiernilsoftlayer global id
hourly_billing_flagtrue
tags[]tags for the server
private_network_onlyfalseif only a private network
use_private_ip_with_public_networkfalseotherwise uses public ip
user_datanilstring of user data for server
uidnilsoftlayer global id
vlannilnumeric id of vlan for server
private_vlannilnumeric id of private_vlan for server
provision_scriptnilurl of provision script to run

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run style checks and RSpec tests (bundle exec rake)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request