Primary IPv6 Addresses¶
- 17129: 1 IPv6 Address
SoftLayer is a public cloud host, and baremetal hardware hosting service.
The SoftLayer driver for Salt Cloud requires the softlayer package, which is available at PyPI:
https://pypi.python.org/pypi/SoftLayer
This package can be installed using pip
or easy_install
:
# pip install softlayer
# easy_install softlayer
Set up the cloud config at /etc/salt/cloud.providers
:
# Note: These examples are for /etc/salt/cloud.providers
my-softlayer:
# Set up the location of the salt master
minion:
master: saltmaster.example.com
# Set the SoftLayer access credentials (see below)
user: MYUSER1138
apikey: 'e3b68aa711e6deadc62d5b76355674beef7cc3116062ddbacafe5f7e465bfdc9'
driver: softlayer
my-softlayer-hw:
# Set up the location of the salt master
minion:
master: saltmaster.example.com
# Set the SoftLayer access credentials (see below)
user: MYUSER1138
apikey: 'e3b68aa711e6deadc62d5b76355674beef7cc3116062ddbacafe5f7e465bfdc9'
driver: softlayer_hw
注解
在 2015.8.0 版更改.
The provider
parameter in cloud provider definitions was renamed to driver
. This
change was made to avoid confusion with the provider
parameter that is used in cloud profile
definitions. Cloud provider definitions now use driver
to refer to the Salt cloud module that
provides the underlying functionality to connect to a cloud host, while cloud profiles continue
to use provider
to refer to provider configurations that you define.
The user
setting is the same user as is used to log into the SoftLayer
Administration area. The apikey
setting is found inside the Admin area after
logging in:
Account
menu item.Users
link.API Key
column and click View
.Set up an initial profile at /etc/salt/cloud.profiles
:
base_softlayer_ubuntu:
provider: my-softlayer
image: UBUNTU_LATEST
cpu_number: 1
ram: 1024
disk_size: 100
local_disk: True
hourly_billing: True
domain: example.com
location: sjc01
# Optional
max_net_speed: 1000
private_vlan: 396
private_network: True
private_ssh: True
# May be used _instead_of_ image
global_identifier: 320d8be5-46c0-dead-cafe-13e3c51
Most of the above items are required; optional items are specified below.
Images to build an instance can be found using the --list-images
option:
# salt-cloud --list-images my-softlayer
The setting used will be labeled as template
.
This is the number of CPU cores that will be used for this instance. This number may be dependent upon the image that is used. For instance:
Red Hat Enterprise Linux 6 - Minimal Install (64 bit) (1 - 4 Core):
----------
name:
Red Hat Enterprise Linux 6 - Minimal Install (64 bit) (1 - 4 Core)
template:
REDHAT_6_64
Red Hat Enterprise Linux 6 - Minimal Install (64 bit) (5 - 100 Core):
----------
name:
Red Hat Enterprise Linux 6 - Minimal Install (64 bit) (5 - 100 Core)
template:
REDHAT_6_64
Note that the template (meaning, the image option) for both of these is the same, but the names suggests how many CPU cores are supported.
This is the amount of memory, in megabytes, that will be allocated to this instance.
The amount of disk space that will be allocated to this image, in gigabytes.
base_softlayer_ubuntu:
disk_size: 100
2015.8.1 新版功能.
SoftLayer allows up to 5 disks to be specified for a virtual machine upon
creation. Multiple disks can be specified either as a list or a comma-delimited
string. The first disk_size
specified in the string or list will be the first
disk size assigned to the VM.
List Example: .. code-block:: yaml
- base_softlayer_ubuntu:
- disk_size: ['100', '20', '20']
String Example: .. code-block:: yaml
- base_softlayer_ubuntu:
- disk_size: '100, 20, 20'
When true the disks for the computing instance will be provisioned on the host which it runs, otherwise SAN disks will be provisioned.
When true the computing instance will be billed on hourly usage, otherwise it will be billed on a monthly basis.
The domain name that will be used in the FQDN (Fully Qualified Domain Name) for this instance. The domain setting will be used in conjunction with the instance name to form the FQDN.
If set to True, the Minion will be identified by the FQDN (Fully Qualified Domain
Name) which is a result of combining the domain
configuration value and the
Minion name specified either via the CLI or a map file rather than only using the
short host name, or Minion ID. Default is False.
2016.3.0 新版功能.
For example, if the value of domain
is example.com
and a new VM was created
via the CLI with salt-cloud -p base_softlayer_ubuntu my-vm
, the resulting
Minion ID would be my-vm.example.com
.
注解
When enabling the use_fqdn
setting, the Minion ID will be the FQDN and will
interact with salt commands with the FQDN instead of the short hostname. However,
due to the way the SoftLayer API is constructed, some Salt Cloud functions such
as listing nodes or destroying VMs will only list the short hostname of the VM
instead of the FQDN.
Example output displaying the SoftLayer hostname quirk mentioned in the note above
(note the Minion ID is my-vm.example.com
, but the VM to be destroyed is listed
with its short hostname, my-vm
):
# salt-key -L
Accepted Keys:
my-vm.example.com
Denied Keys:
Unaccepted Keys:
Rejected Keys:
#
#
# salt my-vm.example.com test.ping
my-vm.example.com:
True
#
#
# salt-cloud -d my-vm.example.com
[INFO ] salt-cloud starting
[INFO ] POST https://api.softlayer.com/xmlrpc/v3.1/SoftLayer_Account
The following virtual machines are set to be destroyed:
softlayer-config:
softlayer:
my-vm
Proceed? [N/y] y
... proceeding
[INFO ] Destroying in non-parallel mode.
[INFO ] POST https://api.softlayer.com/xmlrpc/v3.1/SoftLayer_Account
[INFO ] POST https://api.softlayer.com/xmlrpc/v3.1/SoftLayer_Virtual_Guest
softlayer-config:
----------
softlayer:
----------
my-vm:
True
Images to build an instance can be found using the --list-locations option:
# salt-cloud --list-location my-softlayer
Specifies the connection speed for the instance's network components. This setting is optional. By default, this is set to 10.
Specifies the uri location of the script to be downloaded and run after the instance is provisioned.
2015.8.1 新版功能.
Example: .. code-block:: yaml
- base_softlayer_ubuntu:
- post_uri: 'https://SOMESERVERIP:8000/myscript.sh'
If it is necessary for an instance to be created within a specific frontend VLAN, the ID for that VLAN can be specified in either the provider or profile configuration.
This ID can be queried using the list_vlans function, as described below. This setting is optional.
If it is necessary for an instance to be created within a specific backend VLAN, the ID for that VLAN can be specified in either the provider or profile configuration.
This ID can be queried using the list_vlans function, as described below. This setting is optional.
If a server is to only be used internally, meaning it does not have a public VLAN associated with it, this value would be set to True. This setting is optional. The default is False.
Whether to run the deploy script on the server using the public IP address or the private IP address. If set to True, Salt Cloud will attempt to SSH into the new server using the private IP address. The default is False. This settiong is optional.
When creating an instance using a custom template, this option is set to the corresponding value obtained using the list_custom_images function. This option will not be used if an image is set, and if an image is not set, it is required.
The profile can be realized now with a salt command:
# salt-cloud -p base_softlayer_ubuntu myserver
Using the above configuration, this will create myserver.example.com.
Once the instance has been created with salt-minion installed, connectivity to it can be verified with Salt:
# salt 'myserver.example.com' test.ping
Set up an initial profile at /etc/salt/cloud.profiles
:
base_softlayer_hw_centos:
provider: my-softlayer-hw
# CentOS 6.0 - Minimal Install (64 bit)
image: 13963
# 2 x 2.0 GHz Core Bare Metal Instance - 2 GB Ram
size: 1921
# 500GB SATA II
hdd: 1267
# San Jose 01
location: 168642
domain: example.com
# Optional
vlan: 396
port_speed: 273
banwidth: 248
Most of the above items are required; optional items are specified below.
Images to build an instance can be found using the --list-images option:
# salt-cloud --list-images my-softlayer-hw
A list of id`s and names will be provided. The `name will describe the operating system and architecture. The id will be the setting to be used in the profile.
Sizes to build an instance can be found using the --list-sizes option:
# salt-cloud --list-sizes my-softlayer-hw
A list of id`s and names will be provided. The `name will describe the speed and quantity of CPU cores, and the amount of memory that the hardware will contain. The id will be the setting to be used in the profile.
There is currently only one size of hard disk drive (HDD) that is available for hardware instances on SoftLayer:
1267: 500GB SATA II
The hdd setting in the profile should be 1267. Other sizes may be added in the future.
Locations to build an instance can be found using the --list-images option:
# salt-cloud --list-locations my-softlayer-hw
A list of IDs and names will be provided. The location will describe the location in human terms. The id will be the setting to be used in the profile.
The domain name that will be used in the FQDN (Fully Qualified Domain Name) for this instance. The domain setting will be used in conjunction with the instance name to form the FQDN.
If it is necessary for an instance to be created within a specific VLAN, the ID for that VLAN can be specified in either the provider or profile configuration.
This ID can be queried using the list_vlans function, as described below.
Specifies the speed for the instance's network port. This setting refers to an ID within the SoftLayer API, which sets the port speed. This setting is optional. The default is 273, or, 100 Mbps Public & Private Networks. The following settings are available:
Specifies the network bandwidth available for the instance. This setting refers to an ID within the SoftLayer API, which sets the bandwidth. This setting is optional. The default is 248, or, 5000 GB Bandwidth. The following settings are available:
The following actions are currently supported by the SoftLayer Salt Cloud driver.
This action is a thin wrapper around --full-query, which displays details on a single instance only. In an environment with several machines, this will save a user from having to sort through all instance data, just to examine a single instance.
$ salt-cloud -a show_instance myinstance
The following functions are currently supported by the SoftLayer Salt Cloud driver.
This function lists all VLANs associated with the account, and all known data from the SoftLayer API concerning those VLANs.
$ salt-cloud -f list_vlans my-softlayer
$ salt-cloud -f list_vlans my-softlayer-hw
The id returned in this list is necessary for the vlan option when creating an instance.
This function lists any custom templates associated with the account, that can be used to create a new instance.
$ salt-cloud -f list_custom_images my-softlayer
The globalIdentifier returned in this list is necessary for the global_identifier option when creating an image using a custom template.
The softlayer_hw driver supports the ability to add optional products, which are supported by SoftLayer's API. These products each have an ID associated with them, that can be passed into Salt Cloud with the optional_products option:
softlayer_hw_test:
provider: my-softlayer-hw
# CentOS 6.0 - Minimal Install (64 bit)
image: 13963
# 2 x 2.0 GHz Core Bare Metal Instance - 2 GB Ram
size: 1921
# 500GB SATA II
hdd: 1267
# San Jose 01
location: 168642
domain: example.com
optional_products:
# MySQL for Linux
- id: 28
# Business Continuance Insurance
- id: 104
These values can be manually obtained by looking at the source of an order page on the SoftLayer web interface. For convenience, many of these values are listed here: