|
|
@ -101,9 +101,17 @@ options:
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
zone:
|
|
|
|
zone:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of the zone you wish the ISO to be registered or deleted from. If not specified, first zone found will be used.
|
|
|
|
- Name of the zone you wish the ISO to be registered or deleted from.
|
|
|
|
|
|
|
|
- If not specified, first zone found will be used.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
|
|
|
|
cross_zones:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Whether the ISO should be synced or removed across zones.
|
|
|
|
|
|
|
|
- Mutually exclusive with C(zone).
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: false
|
|
|
|
|
|
|
|
version_added: "2.4"
|
|
|
|
iso_filter:
|
|
|
|
iso_filter:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Name of the filter used to search for the ISO.
|
|
|
|
- Name of the filter used to search for the ISO.
|
|
|
@ -205,6 +213,12 @@ created:
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: string
|
|
|
|
type: string
|
|
|
|
sample: 2015-03-29T14:57:06+0200
|
|
|
|
sample: 2015-03-29T14:57:06+0200
|
|
|
|
|
|
|
|
cross_zones:
|
|
|
|
|
|
|
|
description: true if the ISO is managed across all zones, false otherwise.
|
|
|
|
|
|
|
|
returned: success
|
|
|
|
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
sample: false
|
|
|
|
|
|
|
|
version_added: "2.4"
|
|
|
|
domain:
|
|
|
|
domain:
|
|
|
|
description: Domain the ISO is related to.
|
|
|
|
description: Domain the ISO is related to.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
@ -239,6 +253,8 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
'checksum': 'checksum',
|
|
|
|
'checksum': 'checksum',
|
|
|
|
'status': 'status',
|
|
|
|
'status': 'status',
|
|
|
|
'isready': 'is_ready',
|
|
|
|
'isready': 'is_ready',
|
|
|
|
|
|
|
|
'crossZones': 'cross_zones',
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.iso = None
|
|
|
|
self.iso = None
|
|
|
|
|
|
|
|
|
|
|
@ -254,7 +270,6 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
def register_iso(self):
|
|
|
|
def register_iso(self):
|
|
|
|
args = self._get_common_args()
|
|
|
|
args = self._get_common_args()
|
|
|
|
args.update({
|
|
|
|
args.update({
|
|
|
|
'zoneid': self.get_zone('id'),
|
|
|
|
|
|
|
|
'domainid': self.get_domain('id'),
|
|
|
|
'domainid': self.get_domain('id'),
|
|
|
|
'account': self.get_account('name'),
|
|
|
|
'account': self.get_account('name'),
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
@ -262,6 +277,12 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
'isfeatured': self.module.params.get('is_featured'),
|
|
|
|
'isfeatured': self.module.params.get('is_featured'),
|
|
|
|
'ispublic': self.module.params.get('is_public'),
|
|
|
|
'ispublic': self.module.params.get('is_public'),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.params.get('cross_zones'):
|
|
|
|
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
args['zoneid'] = -1
|
|
|
|
|
|
|
|
|
|
|
|
if args['bootable'] and not args['ostypeid']:
|
|
|
|
if args['bootable'] and not args['ostypeid']:
|
|
|
|
self.module.fail_json(msg="OS type 'os_type' is requried if 'bootable=true'.")
|
|
|
|
self.module.fail_json(msg="OS type 'os_type' is requried if 'bootable=true'.")
|
|
|
|
|
|
|
|
|
|
|
@ -296,6 +317,14 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
})
|
|
|
|
})
|
|
|
|
if self.has_changed(args, iso):
|
|
|
|
if self.has_changed(args, iso):
|
|
|
|
self.result['changed'] = True
|
|
|
|
self.result['changed'] = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.params.get('cross_zones'):
|
|
|
|
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
# Workaround API does not return cross_zones=true
|
|
|
|
|
|
|
|
self.result['cross_zones'] = True
|
|
|
|
|
|
|
|
args['zoneid'] = -1
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.check_mode:
|
|
|
|
if not self.module.check_mode:
|
|
|
|
res = self.cs.updateIso(**args)
|
|
|
|
res = self.cs.updateIso(**args)
|
|
|
|
if 'errortext' in res:
|
|
|
|
if 'errortext' in res:
|
|
|
@ -311,9 +340,11 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
'domainid': self.get_domain('id'),
|
|
|
|
'domainid': self.get_domain('id'),
|
|
|
|
'account': self.get_account('name'),
|
|
|
|
'account': self.get_account('name'),
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
|
'zoneid': self.get_zone('id'),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.params.get('cross_zones'):
|
|
|
|
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
|
|
|
|
# if checksum is set, we only look on that.
|
|
|
|
# if checksum is set, we only look on that.
|
|
|
|
checksum = self.module.params.get('checksum')
|
|
|
|
checksum = self.module.params.get('checksum')
|
|
|
|
if not checksum:
|
|
|
|
if not checksum:
|
|
|
@ -338,9 +369,11 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
args = {
|
|
|
|
args = {
|
|
|
|
'id': iso['id'],
|
|
|
|
'id': iso['id'],
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
|
'projectid': self.get_project('id'),
|
|
|
|
'zoneid': self.get_zone('id'),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.params.get('cross_zones'):
|
|
|
|
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.check_mode:
|
|
|
|
if not self.module.check_mode:
|
|
|
|
res = self.cs.deleteIso(**args)
|
|
|
|
res = self.cs.deleteIso(**args)
|
|
|
|
if 'errortext' in res:
|
|
|
|
if 'errortext' in res:
|
|
|
@ -350,6 +383,15 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|
|
|
self.poll_job(res, 'iso')
|
|
|
|
self.poll_job(res, 'iso')
|
|
|
|
return iso
|
|
|
|
return iso
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_result(self, iso):
|
|
|
|
|
|
|
|
super(AnsibleCloudStackIso, self).get_result(iso)
|
|
|
|
|
|
|
|
# Workaround API does not return cross_zones=true
|
|
|
|
|
|
|
|
if self.module.params.get('cross_zones'):
|
|
|
|
|
|
|
|
self.result['cross_zones'] = True
|
|
|
|
|
|
|
|
if 'zone' in self.result:
|
|
|
|
|
|
|
|
del self.result['zone']
|
|
|
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
argument_spec = cs_argument_spec()
|
|
|
|
argument_spec = cs_argument_spec()
|
|
|
@ -359,6 +401,7 @@ def main():
|
|
|
|
url=dict(),
|
|
|
|
url=dict(),
|
|
|
|
os_type=dict(),
|
|
|
|
os_type=dict(),
|
|
|
|
zone=dict(),
|
|
|
|
zone=dict(),
|
|
|
|
|
|
|
|
cross_zones=dict(type='bool', default=False),
|
|
|
|
iso_filter=dict(default='self', choices=['featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community']),
|
|
|
|
iso_filter=dict(default='self', choices=['featured', 'self', 'selfexecutable', 'sharedexecutable', 'executable', 'community']),
|
|
|
|
domain=dict(),
|
|
|
|
domain=dict(),
|
|
|
|
account=dict(),
|
|
|
|
account=dict(),
|
|
|
@ -376,6 +419,9 @@ def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
required_together=cs_required_together(),
|
|
|
|
required_together=cs_required_together(),
|
|
|
|
|
|
|
|
mutually_exclusive=(
|
|
|
|
|
|
|
|
['zone', 'cross_zones'],
|
|
|
|
|
|
|
|
),
|
|
|
|
supports_check_mode=True
|
|
|
|
supports_check_mode=True
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|