|
|
|
@ -18,33 +18,39 @@ description:
|
|
|
|
|
- Create templates from a ROOT volume of a stopped VM or its snapshot.
|
|
|
|
|
- Update (since version 2.7), extract and delete templates.
|
|
|
|
|
version_added: '2.0'
|
|
|
|
|
author: "René Moser (@resmo)"
|
|
|
|
|
author: René Moser (@resmo)
|
|
|
|
|
options:
|
|
|
|
|
name:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the template.
|
|
|
|
|
type: str
|
|
|
|
|
required: true
|
|
|
|
|
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 C(vm).
|
|
|
|
|
- Mutually exclusive with I(vm).
|
|
|
|
|
type: str
|
|
|
|
|
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 C(url).
|
|
|
|
|
- Mutually exclusive with I(url).
|
|
|
|
|
type: str
|
|
|
|
|
snapshot:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the snapshot, created from the VM ROOT volume, the template will be created from.
|
|
|
|
|
- C(vm) is required together with this argument.
|
|
|
|
|
- I(vm) is required together with this argument.
|
|
|
|
|
type: str
|
|
|
|
|
os_type:
|
|
|
|
|
description:
|
|
|
|
|
- OS type that best represents the OS of this template.
|
|
|
|
|
type: str
|
|
|
|
|
checksum:
|
|
|
|
|
description:
|
|
|
|
|
- The MD5 checksum value of this template.
|
|
|
|
|
- If set, we search by checksum instead of name.
|
|
|
|
|
type: str
|
|
|
|
|
is_ready:
|
|
|
|
|
description:
|
|
|
|
|
- "Note: this flag was not implemented and therefore marked as deprecated."
|
|
|
|
@ -53,61 +59,69 @@ options:
|
|
|
|
|
is_public:
|
|
|
|
|
description:
|
|
|
|
|
- Register the template to be publicly available to all users.
|
|
|
|
|
- Only used if C(state) is present.
|
|
|
|
|
- Only used if I(state) is C(present).
|
|
|
|
|
type: bool
|
|
|
|
|
is_featured:
|
|
|
|
|
description:
|
|
|
|
|
- Register the template to be featured.
|
|
|
|
|
- Only used if C(state) is present.
|
|
|
|
|
- Only used if I(state) is C(present).
|
|
|
|
|
type: bool
|
|
|
|
|
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 C(state) is present.
|
|
|
|
|
- Only used if I(state) is C(present).
|
|
|
|
|
type: bool
|
|
|
|
|
cross_zones:
|
|
|
|
|
description:
|
|
|
|
|
- Whether the template should be synced or removed across zones.
|
|
|
|
|
- Only used if C(state) is present or absent.
|
|
|
|
|
- Only used if I(state) is C(present) or C(absent).
|
|
|
|
|
default: no
|
|
|
|
|
type: bool
|
|
|
|
|
mode:
|
|
|
|
|
description:
|
|
|
|
|
- Mode for the template extraction.
|
|
|
|
|
- Only used if I(state=extracted).
|
|
|
|
|
type: str
|
|
|
|
|
default: http_download
|
|
|
|
|
choices: [ http_download, ftp_upload ]
|
|
|
|
|
domain:
|
|
|
|
|
description:
|
|
|
|
|
- Domain the template, snapshot or VM is related to.
|
|
|
|
|
type: str
|
|
|
|
|
account:
|
|
|
|
|
description:
|
|
|
|
|
- Account the template, snapshot or VM is related to.
|
|
|
|
|
type: str
|
|
|
|
|
project:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the project the template to be registered in.
|
|
|
|
|
type: str
|
|
|
|
|
zone:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the zone you wish the template to be registered or deleted from.
|
|
|
|
|
- If not specified, first found zone will be used.
|
|
|
|
|
type: str
|
|
|
|
|
template_filter:
|
|
|
|
|
description:
|
|
|
|
|
- Name of the filter used to search for the template.
|
|
|
|
|
- The filter C(all) was added in 2.7.
|
|
|
|
|
type: str
|
|
|
|
|
default: self
|
|
|
|
|
choices: [ all, featured, self, selfexecutable, sharedexecutable, executable, community ]
|
|
|
|
|
template_find_options:
|
|
|
|
|
description:
|
|
|
|
|
- Options to find a template uniquely.
|
|
|
|
|
- More than one allowed.
|
|
|
|
|
type: list
|
|
|
|
|
choices: [ display_text, checksum, cross_zones ]
|
|
|
|
|
version_added: 2.7
|
|
|
|
|
version_added: '2.7'
|
|
|
|
|
aliases: [ template_find_option ]
|
|
|
|
|
default: []
|
|
|
|
|
hypervisor:
|
|
|
|
|
description:
|
|
|
|
|
- Name the hypervisor to be used for creating the new template.
|
|
|
|
|
- Relevant when using I(state=present).
|
|
|
|
|
type: str
|
|
|
|
|
choices:
|
|
|
|
|
- KVM
|
|
|
|
|
- kvm
|
|
|
|
@ -139,20 +153,22 @@ options:
|
|
|
|
|
template_tag:
|
|
|
|
|
description:
|
|
|
|
|
- The tag for this template.
|
|
|
|
|
type: str
|
|
|
|
|
sshkey_enabled:
|
|
|
|
|
description:
|
|
|
|
|
- True if the template supports the sshkey upload feature.
|
|
|
|
|
- Only considered if C(url) is used (API limitation).
|
|
|
|
|
- Only considered if I(url) is used (API limitation).
|
|
|
|
|
type: bool
|
|
|
|
|
is_routing:
|
|
|
|
|
description:
|
|
|
|
|
- Sets the template type to routing, i.e. if template is used to deploy routers.
|
|
|
|
|
- Only considered if C(url) is used.
|
|
|
|
|
- Only considered if I(url) is used.
|
|
|
|
|
type: bool
|
|
|
|
|
format:
|
|
|
|
|
description:
|
|
|
|
|
- The format for the template.
|
|
|
|
|
- Only considered if I(state=present).
|
|
|
|
|
type: str
|
|
|
|
|
choices: [ QCOW2, RAW, VHD, OVA ]
|
|
|
|
|
is_extractable:
|
|
|
|
|
description:
|
|
|
|
@ -161,17 +177,21 @@ options:
|
|
|
|
|
details:
|
|
|
|
|
description:
|
|
|
|
|
- Template details in key/value pairs.
|
|
|
|
|
type: str
|
|
|
|
|
bits:
|
|
|
|
|
description:
|
|
|
|
|
- 32 or 64 bits support.
|
|
|
|
|
type: int
|
|
|
|
|
default: 64
|
|
|
|
|
choices: [ 32, 64 ]
|
|
|
|
|
display_text:
|
|
|
|
|
description:
|
|
|
|
|
- Display text of the template.
|
|
|
|
|
type: str
|
|
|
|
|
state:
|
|
|
|
|
description:
|
|
|
|
|
- State of the template.
|
|
|
|
|
type: str
|
|
|
|
|
default: present
|
|
|
|
|
choices: [ present, absent, extracted ]
|
|
|
|
|
poll_async:
|
|
|
|
@ -181,38 +201,38 @@ options:
|
|
|
|
|
type: bool
|
|
|
|
|
tags:
|
|
|
|
|
description:
|
|
|
|
|
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
|
|
|
|
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
|
|
|
|
- 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: [])."
|
|
|
|
|
type: list
|
|
|
|
|
aliases: [ tag ]
|
|
|
|
|
version_added: "2.4"
|
|
|
|
|
version_added: '2.4'
|
|
|
|
|
extends_documentation_fragment: cloudstack
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
|
- name: register a systemvm template
|
|
|
|
|
local_action:
|
|
|
|
|
module: cs_template
|
|
|
|
|
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)
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Create a template from a stopped virtual machine's volume
|
|
|
|
|
local_action:
|
|
|
|
|
module: cs_template
|
|
|
|
|
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
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
# Note: Use template_find_option(s) when a template name is not unique
|
|
|
|
|
- name: Create a template from a stopped virtual machine's volume
|
|
|
|
|
local_action:
|
|
|
|
|
module: cs_template
|
|
|
|
|
cs_template:
|
|
|
|
|
name: Debian 9 (64-bit)
|
|
|
|
|
display_text: Debian 9 (64-bit) 20GB ({{ ansible_date_time.date }})
|
|
|
|
|
template_find_option: display_text
|
|
|
|
@ -221,23 +241,24 @@ EXAMPLES = '''
|
|
|
|
|
zone: tokio-ix
|
|
|
|
|
password_enabled: yes
|
|
|
|
|
is_public: yes
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: create a template from a virtual machine's root volume snapshot
|
|
|
|
|
local_action:
|
|
|
|
|
module: cs_template
|
|
|
|
|
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
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
- name: Remove a template
|
|
|
|
|
local_action:
|
|
|
|
|
module: cs_template
|
|
|
|
|
cs_template:
|
|
|
|
|
name: systemvm-4.2
|
|
|
|
|
cross_zones: yes
|
|
|
|
|
state: absent
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
@ -350,7 +371,7 @@ url:
|
|
|
|
|
tags:
|
|
|
|
|
description: List of resource tags associated with the template.
|
|
|
|
|
returned: if available
|
|
|
|
|
type: dict
|
|
|
|
|
type: list
|
|
|
|
|
sample: '[ { "key": "foo", "value": "bar" } ]'
|
|
|
|
|
zone:
|
|
|
|
|
description: Name of zone the template is registered in.
|
|
|
|
|