cs_service_offering – Manages service offerings on Apache CloudStack based clouds.

New in version 2.5.

Synopsis

  • Create and delete service offerings for guest and system VMs.
  • Update display_text of existing service offering.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • cs >= 0.6.10

Parameters

Parameter Choices/Defaults Comments
api_http_method
-
    Choices:
  • get
  • post
HTTP method used to query the API endpoint.
If not given, the CLOUDSTACK_METHOD env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is get if not specified.
api_key
-
API key of the CloudStack API.
If not given, the CLOUDSTACK_KEY env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
api_region
-
Default:
"cloudstack"
Name of the ini section in the cloustack.ini file.
If not given, the CLOUDSTACK_REGION env variable is considered.
api_secret
-
Secret key of the CloudStack API.
If not set, the CLOUDSTACK_SECRET env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
api_timeout
-
HTTP timeout in seconds.
If not given, the CLOUDSTACK_TIMEOUT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is 10 seconds if not specified.
api_url
-
URL of the CloudStack API e.g. https://cloud.example.com/client/api.
If not given, the CLOUDSTACK_ENDPOINT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
bytes_read_rate
-
Bytes read rate of the disk offering.
bytes_write_rate
-
Bytes write rate of the disk offering.
cpu_number
-
The number of CPUs of the service offering.
cpu_speed
-
The CPU speed of the service offering in MHz.
deployment_planner
-
The deployment planner heuristics used to deploy a VM of this offering.
If not set, the value of global config vm.deployment.planner is used.
disk_iops_customized
-
Default:
"no"
Whether compute offering iops is custom or not.
disk_iops_max
-
Max. iops of the compute offering.
disk_iops_min
-
Min. iops of the compute offering.
disk_iops_read_rate
-
IO requests read rate of the disk offering.
disk_iops_write_rate
-
IO requests write rate of the disk offering.
display_text
-
Display text of the service offering.
If not set, name will be used as display_text while creating.
domain
-
Domain the service offering is related to.
Public for all domains and subdomains if not set.
host_tags
-
The host tagsfor this service offering.

aliases: host_tag
hypervisor_snapshot_reserve
-
Hypervisor snapshot reserve space as a percent of a volume.
Only for managed storage using Xen or VMware.
is_system
boolean
    Choices:
  • no ←
  • yes
Whether it is a system VM offering or not.
is_volatile
boolean
    Choices:
  • no ←
  • yes
Whether the virtual machine needs to be volatile or not.
Every reboot of VM the root disk is detached then destroyed and a fresh root disk is created and attached to VM.
limit_cpu_usage
boolean
    Choices:
  • no
  • yes
Restrict the CPU usage to committed service offering.
memory
-
The total memory of the service offering in MB.
name
- / required
Name of the service offering.
network_rate
-
Data transfer rate in Mb/s allowed.
Supported only for non-system offering and system offerings having system_vm_type=domainrouter.
offer_ha
boolean
    Choices:
  • no ←
  • yes
Whether HA is set for the service offering.
provisioning_type
-
    Choices:
  • thin
  • sparse
  • fat
Provisioning type used to create volumes.
service_offering_details
-
Details for planner, used to store specific parameters.
state
-
    Choices:
  • present ←
  • absent
State of the service offering.
storage_tags
-
The storage tags for this service offering.

aliases: storage_tag
storage_type
-
    Choices:
  • local
  • shared
The storage type of the service offering.
system_vm_type
-
    Choices:
  • domainrouter
  • consoleproxy
  • secondarystoragevm
The system VM type.
Required if is_system=true.

Notes

Note

  • Ansible uses the cs library’s configuration method if credentials are not provided by the arguments api_url, api_key, api_secret. Configuration is read from several locations, in the following order. The CLOUDSTACK_ENDPOINT, CLOUDSTACK_KEY, CLOUDSTACK_SECRET and CLOUDSTACK_METHOD. CLOUDSTACK_TIMEOUT environment variables. A CLOUDSTACK_CONFIG environment variable pointing to an .ini file. A cloudstack.ini file in the current working directory. A .cloudstack.ini file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini. Use the argument api_region to select the section name, default section is cloudstack. See https://github.com/exoscale/cs for more information.
  • A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
  • This module supports check mode.

Examples

- name: Create a non-volatile compute service offering with local storage
  local_action:
    module: cs_service_offering
    name: Micro
    display_text: Micro 512mb 1cpu
    cpu_number: 1
    cpu_speed: 2198
    memory: 512
    host_tags: eco
    storage_type: local

- name: Create a volatile compute service offering with shared storage
  local_action:
    module: cs_service_offering
    name: Tiny
    display_text: Tiny 1gb 1cpu
    cpu_number: 1
    cpu_speed: 2198
    memory: 1024
    storage_type: shared
    is_volatile: true
    host_tags: eco
    storage_tags: eco

- name: Create or update a volatile compute service offering with shared storage
  local_action:
    module: cs_service_offering
    name: Tiny
    display_text: Tiny 1gb 1cpu
    cpu_number: 1
    cpu_speed: 2198
    memory: 1024
    storage_type: shared
    is_volatile: yes
    host_tags: eco
    storage_tags: eco

- name: Remove a compute service offering
  local_action:
    module: cs_service_offering
    name: Tiny
    state: absent

- name: Create or update a system offering for the console proxy
  local_action:
    module: cs_service_offering
    name: System Offering for Console Proxy 2GB
    display_text: System Offering for Console Proxy 2GB RAM
    is_system: yes
    system_vm_type: consoleproxy
    cpu_number: 1
    cpu_speed: 2198
    memory: 2048
    storage_type: shared
    storage_tags: perf

- name: Remove a system offering
  local_action:
    module: cs_service_offering
    name: System Offering for Console Proxy 2GB
    is_system: yes
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
cpu_number
integer
success
Number of CPUs in the service offering

Sample:
4
cpu_speed
integer
success
Speed of CPUs in MHz in the service offering

Sample:
2198
created
string
success
Date the offering was created

Sample:
2017-11-19T10:48:59+0000
disk_bytes_read_rate
integer
success
Bytes read rate of the service offering

Sample:
1000
disk_bytes_write_rate
integer
success
Bytes write rate of the service offering

Sample:
1000
disk_iops_max
integer
success
Max iops of the disk offering

Sample:
1000
disk_iops_min
integer
success
Min iops of the disk offering

Sample:
500
disk_iops_read_rate
integer
success
IO requests per second read rate of the service offering

Sample:
1000
disk_iops_write_rate
integer
success
IO requests per second write rate of the service offering

Sample:
1000
display_text
string
success
Display text of the offering

Sample:
Micro 512mb 1cpu
domain
string
success
Domain the offering is into

Sample:
ROOT
host_tags
list
success
List of host tags

Sample:
['eco']
id
string
success
UUID of the service offering

Sample:
a6f7a5fc-43f8-11e5-a151-feff819cdc9f
is_iops_customized
boolean
success
Whether the offering uses custom IOPS or not

is_system
boolean
success
Whether the offering is for system VMs or not

is_volatile
boolean
success
Whether the offering is volatile or not

limit_cpu_usage
boolean
success
Whether the CPU usage is restricted to committed service offering

memory
integer
success
Memory of the system offering

Sample:
512
name
string
success
Name of the system offering

Sample:
Micro
network_rate
integer
success
Data transfer rate in megabits per second allowed

Sample:
1000
offer_ha
boolean
success
Whether HA support is enabled in the offering or not

provisioning_type
string
success
Provisioning type used to create volumes

Sample:
thin
service_offering_details
dictionary
success
Additioanl service offering details

Sample:
{'vgpuType': 'GRID K180Q','pciDevice':'Group of NVIDIA Corporation GK107GL [GRID K1] GPUs'}
storage_tags
list
success
List of storage tags

Sample:
['eco']
storage_type
string
success
Storage type used to create volumes

Sample:
shared
system_vm_type
string
success
System VM type of this offering

Sample:
consoleproxy


Status

Authors

  • René Moser (@resmo)

Hint

If you notice any issues in this documentation you can edit this document to improve it.