ngine_io / ngine_io.cloudstack / 2.3.0 / module / cs_template Manages templates on Apache CloudStack based clouds. | "added in version" 0.1.0 of ngine_io.cloudstack" Authors: René Moser (@resmo)ngine_io.cloudstack.cs_template (2.3.0) — module
Install with ansible-galaxy collection install ngine_io.cloudstack:==2.3.0
collections: - name: ngine_io.cloudstack version: 2.3.0
Register templates from an URL.
Create templates from a ROOT volume of a stopped VM or its snapshot.
Update, extract and delete templates.
- name: register a systemvm template ngine_io.cloudstack.cs_template: name: systemvm-vmware-4.5 url: "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-vmware.ova" hypervisor: VMware format: OVA cross_zones: yes os_type: Debian GNU/Linux 7(64-bit)
- name: Create a template from a stopped virtual machine's volume ngine_io.cloudstack.cs_template: name: Debian 9 (64-bit) 20GB ({{ ansible_date_time.date }}) vm: debian-9-base-vm os_type: Debian GNU/Linux 9 (64-bit) zone: tokio-ix password_enabled: yes is_public: yes
# Note: Use template_find_option(s) when a template name is not unique - name: Create a template from a stopped virtual machine's volume ngine_io.cloudstack.cs_template: name: Debian 9 (64-bit) display_text: Debian 9 (64-bit) 20GB ({{ ansible_date_time.date }}) template_find_option: display_text vm: debian-9-base-vm os_type: Debian GNU/Linux 9 (64-bit) zone: tokio-ix password_enabled: yes is_public: yes
- name: create a template from a virtual machine's root volume snapshot ngine_io.cloudstack.cs_template: name: Debian 9 (64-bit) Snapshot ROOT-233_2015061509114 snapshot: ROOT-233_2015061509114 os_type: Debian GNU/Linux 9 (64-bit) zone: tokio-ix password_enabled: yes is_public: yes
- name: Remove a template ngine_io.cloudstack.cs_template: name: systemvm-4.2 cross_zones: yes state: absent
vm: description: - VM name the template will be created from its volume or alternatively from a snapshot. - VM must be in stopped state if created from its volume. - Mutually exclusive with I(url). type: str url: description: - URL of where the template is hosted on I(state=present). - URL to which the template would be extracted on I(state=extracted). - Mutually exclusive with I(vm). type: str bits: choices: - 32 - 64 default: 64 description: - 32 or 64 bits support. type: int mode: choices: - http_download - ftp_upload default: http_download description: - Mode for the template extraction. - Only used if I(state=extracted). type: str name: description: - Name of the template. required: true type: str tags: aliases: - tag description: - List of tags. Tags are a list of dictionaries having keys I(key) and I(value). - 'To delete all tags, set a empty list e.g. I(tags: []).' elements: dict type: list zone: description: - Name of the zone you wish the template to be registered or deleted from. - Required when I(cross_zones) is C(no) type: str state: choices: - present - absent - extracted default: present description: - State of the template. type: str domain: description: - Domain the template, snapshot or VM is related to. type: str format: choices: - QCOW2 - RAW - VHD - OVA description: - The format for the template. - Only considered if I(state=present). type: str account: description: - Account the template, snapshot or VM is related to. type: str api_key: description: - API key of the CloudStack API. - If not given, the C(CLOUDSTACK_KEY) env variable is considered. required: true type: str api_url: description: - URL of the CloudStack API e.g. https://cloud.example.com/client/api. - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered. required: true type: str details: description: - Template details in key/value pairs. type: str os_type: description: - OS type that best represents the OS of this template. type: str project: description: - Name of the project the template to be registered in. type: str checksum: description: - The MD5 checksum value of this template. - If set, we search by checksum instead of name. type: str snapshot: description: - Name of the snapshot, created from the VM ROOT volume, the template will be created from. - I(vm) is required together with this argument. type: str is_public: description: - Register the template to be publicly available to all users. - Only used if I(state) is C(present). type: bool api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. required: true type: str hypervisor: description: - Name the hypervisor to be used for creating the new template. - Relevant when using I(state=present). - Possible values are C(KVM), C(VMware), C(BareMetal), C(XenServer), C(LXC), C(HyperV), C(UCS), C(OVM), C(Simulator). type: str is_routing: description: - Sets the template type to routing, i.e. if template is used to deploy routers. - Only considered if I(url) is used. type: bool poll_async: default: true description: - Poll async jobs until job has finished. type: bool api_timeout: default: 10 description: - HTTP timeout in seconds. - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered. type: int cross_zones: default: false description: - Whether the template should be synced or removed across zones. - Only used if I(state) is C(present) or C(absent). type: bool is_featured: description: - Register the template to be featured. - Only used if I(state) is C(present). type: bool display_text: description: - Display text of the template. type: str requires_hvm: description: - Whether the template requires HVM or not. - Only considered while creating the template. type: bool template_tag: description: - The tag for this template. type: str is_extractable: description: - Allows the template or its derivatives to be extractable. type: bool sshkey_enabled: description: - True if the template supports the sshkey upload feature. - Only considered if I(url) is used (API limitation). type: bool api_http_method: choices: - get - post default: get description: - HTTP method used to query the API endpoint. - If not given, the C(CLOUDSTACK_METHOD) env variable is considered. type: str template_filter: choices: - all - featured - self - selfexecutable - sharedexecutable - executable - community default: self description: - Name of the filter used to search for the template. - The filter C(all) was added in 2.7. type: str password_enabled: description: - Enable template password reset support. type: bool api_verify_ssl_cert: description: - Verify CA authority cert file. - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered. type: str template_find_options: aliases: - template_find_option choices: - display_text - checksum - cross_zones default: [] description: - Options to find a template uniquely. - More than one allowed. elements: str type: list is_dynamically_scalable: description: - Register the template having XS/VMware tools installed in order to support dynamic scaling of VM CPU/memory. - Only used if I(state) is C(present). type: bool
account: description: Account the template is related to. returned: success sample: example account type: str checksum: description: MD5 checksum of the template. returned: if available sample: 0b31bccccb048d20b551f70830bb7ad0 type: str created: description: Date of registering. returned: success sample: 2015-03-29T14:57:06+0200 type: str cross_zones: description: true if the template is managed across all zones, false otherwise. returned: if available sample: false type: bool display_text: description: Display text of the template. returned: if available sample: Debian 7.7 64-bit minimal 2015-03-19 type: str domain: description: Domain the template is related to. returned: success sample: example domain type: str format: description: Format of the template. returned: if available sample: OVA type: str hypervisor: description: Hypervisor related to this template. returned: if available sample: VMware type: str id: description: UUID of the template or extracted object. returned: success sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f type: str is_extractable: description: True if the template is extractable. returned: if available sample: true type: bool is_featured: description: True if the template is featured. returned: if available sample: true type: bool is_public: description: True if the template is public. returned: if available sample: true type: bool is_ready: description: True if the template is ready to be deployed from. returned: if available sample: true type: bool mode: description: Mode of extraction returned: on state=extracted sample: http_download type: str name: description: Name of the template or extracted object. returned: success sample: Debian 7 64-bit type: str os_type: description: Type of the OS. returned: if available sample: CentOS 6.5 (64-bit) type: str password_enabled: description: True if the reset password feature is enabled, false otherwise. returned: if available sample: false type: bool project: description: Name of project the template is related to. returned: success sample: Production type: str sshkey_enabled: description: true if template is sshkey enabled, false otherwise. returned: if available sample: false type: bool state: description: State of the extracted template returned: on state=extracted sample: DOWNLOAD_URL_CREATED type: str status: description: Status of the template or extracted object. returned: success sample: Download Complete type: str tags: description: List of resource tags associated with the template. returned: if available sample: '[ { "key": "foo", "value": "bar" } ]' type: list template_tag: description: Template tag related to this template. returned: if available sample: special type: str template_type: description: Type of the template. returned: if available sample: USER type: str url: description: Url to which the template is extracted to returned: on state=extracted sample: http://1.2.3.4/userdata/eb307f13-4aca-45e8-b157-a414a14e6b04.ova type: str zone: description: Name of zone the template is registered in. returned: success sample: zuerich type: str