- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# cs_service_offering – Manages service offerings on Apache CloudStack based clouds

New in version 2.5.

- Synopsis

- Requirements

- Parameters

- Notes

- Examples

- Return Values

- Status

## 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 string | 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 string |  | 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 string | Default: "cloudstack" | Name of the ini section in the `cloustack.ini` file. If not given, the `CLOUDSTACK_REGION` env variable is considered.
api_secret string |  | 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 integer |  | 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 string |  | 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.
cpu_number integer |  | The number of CPUs of the service offering.
cpu_speed integer |  | The CPU speed of the service offering in MHz.
deployment_planner string |  | 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_bytes_read_rate integer |  | Bytes read rate of the disk offering. aliases: bytes_read_rate
disk_bytes_write_rate integer |  | Bytes write rate of the disk offering. aliases: bytes_write_rate
disk_iops_max integer |  | Max. iops of the compute offering.
disk_iops_min integer |  | Min. iops of the compute offering.
disk_iops_read_rate integer |  | IO requests read rate of the disk offering.
disk_iops_write_rate integer |  | IO requests write rate of the disk offering.
display_text string |  | Display text of the service offering. If not set, name will be used as display_text while creating.
domain string |  | Domain the service offering is related to. Public for all domains and subdomains if not set.
host_tags list |  | The host tags for this service offering. aliases: host_tag
hypervisor_snapshot_reserve integer |  | Hypervisor snapshot reserve space as a percent of a volume. Only for managed storage using Xen or VMware.
is_customized boolean added in 2.8 | Choices: no yes | Whether the offering is customizable or not.
is_iops_customized boolean | Choices: no yes | Whether compute offering iops is custom or not. aliases: disk_iops_customized
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 integer |  | The total memory of the service offering in MB.
name string / required |  | Name of the service offering.
network_rate integer |  | 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 string | Choices: thin sparse fat | Provisioning type used to create volumes.
service_offering_details list |  | Details for planner, used to store specific parameters. A list of dictionaries having keys `key` and `value`.
state string | Choices: present ← absent | State of the service offering.
storage_tags list |  | The storage tags for this service offering. aliases: storage_tag
storage_type string | Choices: local shared | The storage type of the service offering.
system_vm_type string | Choices: domainrouter consoleproxy secondarystoragevm | The system VM type. Required if is_system=yes.

## 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
      cs_service_offering:
        name: Micro
        display_text: Micro 512mb 1cpu
        cpu_number: 1
        cpu_speed: 2198
        memory: 512
        host_tags: eco
        storage_type: local
      delegate_to: localhost

    - name: Create a volatile compute service offering with shared storage
      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
      delegate_to: localhost

    - name: Create or update a volatile compute service offering with shared storage
      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
      delegate_to: localhost

    - name: Create or update a custom compute service offering
      cs_service_offering:
        name: custom
        display_text: custom compute offer
        is_customized: yes
        storage_type: shared
        host_tags: eco
        storage_tags: eco
      delegate_to: localhost

    - name: Remove a compute service offering
      cs_service_offering:
        name: Tiny
        state: absent
      delegate_to: localhost

    - name: Create or update a system offering for the console proxy
      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
      delegate_to: localhost

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

## 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_customized boolean added in 2.8 | success | Whether the offering is customizable or not
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

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Community. [community]

### Authors

- René Moser (@resmo)

Hint

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