From 68d2251016a09beaad5aec31c2315d5e23b3a4d2 Mon Sep 17 00:00:00 2001 From: Paul Markham Date: Fri, 26 Jun 2015 09:44:33 +1000 Subject: [PATCH] - Renamed module to solaris_zone.py - Updated 'version_added' - Updated description of 'state' to make each line a list item - Check that OS is Solaris --- .../system/{zone.py => solaris_zone.py} | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) rename lib/ansible/modules/extras/system/{zone.py => solaris_zone.py} (93%) diff --git a/lib/ansible/modules/extras/system/zone.py b/lib/ansible/modules/extras/system/solaris_zone.py similarity index 93% rename from lib/ansible/modules/extras/system/zone.py rename to lib/ansible/modules/extras/system/solaris_zone.py index d24001c973f..be693bf1425 100644 --- a/lib/ansible/modules/extras/system/zone.py +++ b/lib/ansible/modules/extras/system/solaris_zone.py @@ -24,12 +24,12 @@ import tempfile DOCUMENTATION = ''' --- -module: zone +module: solaris_zone short_description: Manage Solaris zones description: - Create, start, stop and delete Solaris zones. This module doesn't currently allow changing of options for a zone that's already been created. -version_added: "1.5" +version_added: "2.0" author: Paul Markham requirements: - Solaris 10 or later @@ -38,10 +38,10 @@ options: required: true description: - C(present), create the zone. - C(running), if the zone already exists, boot it, otherwise, create the zone + - C(running), if the zone already exists, boot it, otherwise, create the zone first, then boot it. - C(stopped), shutdown a zone. - C(absent), destroy the zone. + - C(stopped), shutdown a zone. + - C(absent), destroy the zone. choices: ['present', 'running', 'stopped', 'absent'] name: description: @@ -89,21 +89,21 @@ options: EXAMPLES = ''' # Create a zone, but don't boot it -zone: name=zone1 state=present path=/zones/zone1 whole_root=true root_password="Be9oX7OSwWoU." +solaris_zone: name=zone1 state=present path=/zones/zone1 whole_root=true root_password="Be9oX7OSwWoU." config='set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end' # Create a zone and boot it -zone: name=zone1 state=running path=/zones/zone1 whole_root=true root_password="Be9oX7OSwWoU." +solaris_zone: name=zone1 state=running path=/zones/zone1 whole_root=true root_password="Be9oX7OSwWoU." config='set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end' # Boot an already created zone -zone: name=zone1 state=running +solaris_zone: name=zone1 state=running # Stop a zone -zone: name=zone1 state=stopped +solaris_zone: name=zone1 state=stopped # Destroy a zone -zone: name=zone1 state=absent +solaris_zone: name=zone1 state=absent ''' class Zone(object): @@ -332,6 +332,13 @@ def main(): supports_check_mode=True ) + if platform.system() == 'SunOS': + (major, minor) = platform.release().split('.') + if minor < 10: + module.fail_json(msg='This module requires Solaris 10 or later') + else: + module.fail_json(msg='This module requires Solaris') + zone = Zone(module) state = module.params['state']