The CLC module manages CenturyLink Cloud resources to build out cloud infrastructure.
CenturyLink Cloud exposes a powerful API for creating and managing its Infrastructure-as-a-Service platform. In the simplest case, this allows you to manage CLC servers from Puppet code. It also allows to you to describe other resources (like resource groups, networks) and to model the relationships between different components.
- Ruby 1.9 and later
- Puppet versions 4.3 and later
-
Install the required Ruby gems.
/opt/puppetlabs/puppet/bin/gem install hocon --no-ri --no-rdoc
On versions of Puppet Enterprise older than 2015.2.0, use the older path to the
gem
binary:/opt/puppet/bin/gem install hocon --no-ri --no-rdoc
-
Set these environment variables for your CenturyLink Cloud access credentials:
export CLC_USERNAME=your_username export CLC_PASSWORD=your_password
Alternatively, you can provide the information in a configuration file of HOCON format. Store this as clc.conf in the relevant confdir.
This should be:
- nix Systems:
/etc/puppetlabs/puppet
- Windows:
C:\ProgramData\PuppetLabs\puppet\etc
- non-root users:
~/.puppetlabs/etc/puppet
The file format is:
clc: { username: "your_username" password: "your_password" }
- nix Systems:
-
Finally, install the module with:
puppet module install centurylink-clc
clc_server { 'name-of-server':
ensure => presebt,
cpu => 2,
memory => 4, # in GB
group_id => '5757349d19c343a88ce9a473fe2522f4',
source_server_id => 'DEBIAN-7-64-TEMPLATE',
password => 'pa$$w0rd',
primary_dns => '4.4.4.4',
secondary_dns => '8.8.8.8',
public_ip_address => {
ports => [{
protocol => TCP,
port => 80
}]
}
}
clc_group { 'name-of-group':
ensure => present,
description => 'Group description',
datacenter => 'VA1'
}
Alternatively you can define parent_group_id instead of datacenter to create a subgroup:
clc_group { 'name-of-subgroup':
ensure => present,
description => 'Group description',
parent_group_id => '5757349d19c343a88ce9a473fe2522f4'
}
Also, you can refer to the group by name:
clc_group { 'name-of-parent-group':
ensure => present,
description => 'Parent group description',
datacenter => 'VA1'
}
clc_group { 'name-of-subgroup':
ensure => present,
description => 'Group description',
parent_group => 'name-of-parent-group'
}
clc_server
: Manages a server in CenturyLink Cloud.clc_group
: Manages a CenturyLink Cloud group.clc_network
: Manages a CenturyLink Cloud network.clc_template
: A CenturyLink Cloud template. Works only for retrieval using a Puppet resource CLI.clc_dc
: A CenturyLink Cloud datacenter. Work only for retrieval using a Puppet resource CLI.
Specifies the basic state of the resource. Valid values are 'present', 'absent', 'started', 'stopped', 'paused'.
Values have the following effects:
- 'present': Ensures that the server exists in either the started, stopped, or paused state. If the server doesn't yet exist, a new one is created.
- 'started': Ensures that the server is up and running. If the server doesn't yet exist, a new one is created. This can be used to resume paused servers.
- 'stopped': Ensures that the server is created, but is not running. This can be used to shut down running servers.
- 'paused': Ensures that the server is created, but is paused. This can be used to pause running servers.
- 'absent': Ensures that the server doesn't exist on CenturyLink Cloud.
Specifies the number of CPU cores. Valid values are in the 1..16 range.
Specifies the amount of RAM (in gigabytes). Valid values are in the 1..128 range.
ID of the parent group. Could be empty if group
is specified.
Name of the parent group. Could be empty if group_id
is specified.
Required ID of the server to use a source. May be the ID of a template, or when cloning, an existing server ID.
Boolean. Whether to create the server as managed or not. Defaults to false.
Boolean. Whether to add managed backup to the server. Must be a managed server. Defaults to false.
Type of server to create. Valid values are 'standard', 'hyperscale', or 'bareMetal'. Defaults to 'standard'.
Type of storage for server. Valid values are 'standard', 'premium', or 'hyperscale'.
Primary DNS to set on the server.
Secondary DNS to set on the server.
ID of the network to which to deploy the server.
Name of the network to which to deploy the server.
IP address to assign to the server. If not provided, one will be assigned automatically.
Password of administrator or root user on server. If not provided, one will be generated automatically.
Password of the source server, used only when creating a clone from an existing server (e.g. source_server_id
referencing existing server).
Collection of custom field ID-value pairs to set for the server.
Public IP address settings. Valid values are 'settings hash' or 'absent'.
Values:
-
settings hash: hash with two keys
- ports: array of hashes with protocol/port pairs
- source_restrictions: array of hashes with source restrictions cidr
Example:
clc_server { 'test-server': .... public_ip_address => { ports => [{protocol => TCP, port => 80}, {protocol => TCP, port => 443}], source_restrictions => [{cidr => '10.0.0.0/24'}] } ... }
-
'absent': deletes assigned public IP.
Read only ID of the server.
Read only Details about IP addresses associated with the server.
Read only The disks attached to the server.
Read only Data center that this server resides in.
Read only Friendly name of the Operating System (OS) that the server is running.
Read only Server OS.
Specifies the basic state of the resource. Valid values are 'present' and 'absent'.
Values have the following effects:
- 'present': Ensure that the group exists. If the group doesn't yet exist, a new one is created.
- 'absent': Ensures that the group doesn't exist on CenturyLink Cloud.
User-defined description of the group.
Read only Number of servers this group contains.
ID of the parent group. Could be empty if parent_group
or datacenter
is specified.
Name of the parent group. Could be empty if parent_group_id
or datacenter
is specified.
Name of the parent datacenter, if specified group will be created as a top-level group in datacenter.
Could be empty if parent_group_id
or parent_group
is specified.
Read only ID of the group.
Collection of custom field ID-value pairs to set for the group.
Default values for the group. Value must be a hash. Valid hash keys are: 'cpu', 'memory', 'primary_dns', 'secondary_dns', 'network_id', and 'template_name'.
- 'cpu': Number of processors to configure the server. Value is an integer within the 1..16 range.
- 'memory': Number of GB of memory to configure the server. Value is an integer within the 1..128 range.
- 'primary_dns': Primary DNS to set on the server.
- 'secondary_dbs': Secondary DNS to set on the server.
- 'network_id': ID of the Network.
- 'template_name': Name of the template to use as the source.
Example:
clc_group { 'test-group':
...
defaults => {
cpu => 2,
memory => 4,
primary_dns => '4.4.4.4',
secondary_dns => '8.8.8.8',
template_name => 'DEBIAN-7-64-TEMPLATE',
}
...
}
Scheduled activities for a group. Value must be an array of hashes. Valid hash keys are: 'status', 'type', 'begin_date', 'repeat', 'custom_weekly_days', 'expire', 'expire_count', 'expire_date', and 'time_zone_offset'.
- 'status': State of scheduled activity: 'on' or 'off'. Required
- 'type': Type of activity: 'archive', 'createsnapshot', 'delete', 'deletesnapshot', 'pause', 'poweron', 'reboot', 'shutdown'. Required
- 'begin_date': Time when scheduled activity should start (UTC). Required
- 'repeat': How often to repeat: 'never', 'daily', 'weekly', 'monthly', 'customWeekly'. Required
- 'custom_weekly_days': An array of strings for the days of the week: 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'.
- 'expire': When the scheduled activities are set to expire: 'never', 'afterDate', 'afterCount'. Required
- 'expire_count': Number of times scheduled activity should run before expiring.
- 'expire_date': When the scheduled activity should expire (UTC).
- 'time_zone_offset': To display in local time. Required
Example:
clc_group { 'test-group':
...
scheduled_activities => [
{
status => on,
'type' => reboot,
begin_date => "2015-11-23T19:41:00.000Z",
time_zone_offset => "-08:00",
repeat => weekly,
expire => never
},
{
status => on,
'type' => reboot,
begin_date => "2015-11-23T19:41:00.000Z",
time_zone_offset => "-08:00",
repeat => customWeekly,
expire => never,
custom_weekly_days => ['mon', 'wed', 'fri']
}
]
...
}
Specifies the basic state of the resource. Valid values are 'present' and 'absent'.
Values have the following effects:
- 'present': Ensure that the network exists. If the network doesn't yet exist, a new one is created.
- 'absent': Ensures that the network doesn't exist on CenturyLink Cloud.
User-defined description of the network.
Parent data center.
Read only ID of the network.
This module requires Ruby 1.9 or later and is only tested on Puppet versions 4.3 and later.
- Fork the main repository. https://github.com/CenturyLinkCloud/clc-puppet/fork.
- Create a feature branch from the master branch.
git checkout -b my-new-feature
- Commit your changes to the feature branch.
git commit -am 'Add some feature'
- Push to the master branch.
git push origin my-new-feature
- Create a new Pull Request (to CenturyLinkCloud/clc-puppet).
- Specs and Code Style checks should pass before the Code Review.
The project is licensed under the Apache License v2.0.