summaryrefslogtreecommitdiff
path: root/cloud/cloudstack/cs_instance.py
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2016-04-12 18:46:02 +0200
committerRené Moser <mail@renemoser.net>2016-04-12 18:46:02 +0200
commit30a46ee542767676c12474c73b56763f2912be4b (patch)
treeb9f4ab8af8f0177d679efcfb8fee68b4b604d208 /cloud/cloudstack/cs_instance.py
parent442c286b1c06669c45cea222a6cdcd7ddaaffc48 (diff)
downloadansible-modules-extras-30a46ee542767676c12474c73b56763f2912be4b.tar.gz
cloudstack: cs_instance: fix template not found (#2005)
Let users decide which filter should be used to find the template.
Diffstat (limited to 'cloud/cloudstack/cs_instance.py')
-rw-r--r--cloud/cloudstack/cs_instance.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cloud/cloudstack/cs_instance.py b/cloud/cloudstack/cs_instance.py
index 9674b589..eeac0416 100644
--- a/cloud/cloudstack/cs_instance.py
+++ b/cloud/cloudstack/cs_instance.py
@@ -87,6 +87,15 @@ options:
- Mutually exclusive with C(template) option.
required: false
default: null
+ template_filter:
+ description:
+ - Name of the filter used to search for the template or iso.
+ - Used for params C(iso) or C(template) on C(state=present).
+ required: false
+ default: 'executable'
+ choices: [ 'featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community' ]
+ aliases: [ 'iso_filter' ]
+ version_added: '2.1'
hypervisor:
description:
- Name the hypervisor to be used for creating the new instance.
@@ -450,7 +459,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
if self.template:
return self._get_by_key(key, self.template)
- args['templatefilter'] = 'executable'
+ args['templatefilter'] = self.module.params.get('template_filter')
templates = self.cs.listTemplates(**args)
if templates:
for t in templates['template']:
@@ -462,7 +471,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
elif iso:
if self.iso:
return self._get_by_key(key, self.iso)
- args['isofilter'] = 'executable'
+ args['isofilter'] = self.module.params.get('template_filter')
isos = self.cs.listIsos(**args)
if isos:
for i in isos['iso']:
@@ -913,6 +922,7 @@ def main():
memory = dict(default=None, type='int'),
template = dict(default=None),
iso = dict(default=None),
+ template_filter = dict(default="executable", aliases=['iso_filter'], choices=['featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community']),
networks = dict(type='list', aliases=[ 'network' ], default=None),
ip_to_networks = dict(type='list', aliases=['ip_to_network'], default=None),
ip_address = dict(defaul=None),